home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.90.02.sit / SC.014.CPlusTESample / TEDocument.cp < prev    next >
MacBinary  |  1989-10-01  |  23.9 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun Oct 1 00:00:00 1989, modified Sun Oct 1 00:00:00 1989, creator 'MPS ', type ASCII, 23833 bytes "TEDocument.cp" , at 0x5d99 316 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0d 54 45 44 6f 63 75 | 6d 65 6e 74 2e 63 70 00 |..TEDocu|ment.cp.|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 5d 19 00 | 00 01 3c a1 4b 3c 40 a1 |.....]..|..<.K<@.|
|00000060| 4b 3c 40 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |K<@.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 a5 21 00 00 |........|.....!..|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000d0| 0d 23 0d 23 09 41 70 70 | 6c 65 20 4d 61 63 69 6e |.#.#.App|le Macin|
|000000e0| 74 6f 73 68 20 44 65 76 | 65 6c 6f 70 65 72 20 54 |tosh Dev|eloper T|
|000000f0| 65 63 68 6e 69 63 61 6c | 20 53 75 70 70 6f 72 74 |echnical| Support|
|00000100| 0d 23 0d 23 09 4d 75 6c | 74 69 46 69 6e 64 65 72 |.#.#.Mul|tiFinder|
|00000110| 2d 41 77 61 72 65 20 53 | 69 6d 70 6c 65 20 54 65 |-Aware S|imple Te|
|00000120| 78 74 45 64 69 74 20 53 | 61 6d 70 6c 65 20 41 70 |xtEdit S|ample Ap|
|00000130| 70 6c 69 63 61 74 69 6f | 6e 0d 23 0d 23 09 43 50 |plicatio|n.#.#.CP|
|00000140| 6c 75 73 54 45 53 61 6d | 70 6c 65 0d 23 0d 23 09 |lusTESam|ple.#.#.|
|00000150| 54 45 44 6f 63 75 6d 65 | 6e 74 2e 63 70 09 2d 09 |TEDocume|nt.cp.-.|
|00000160| 43 2b 2b 20 73 6f 75 72 | 63 65 0d 23 0d 23 09 43 |C++ sour|ce.#.#.C|
|00000170| 6f 70 79 72 69 67 68 74 | 20 a9 20 31 39 38 39 20 |opyright| . 1989 |
|00000180| 41 70 70 6c 65 20 43 6f | 6d 70 75 74 65 72 2c 20 |Apple Co|mputer, |
|00000190| 49 6e 63 2e 0d 23 09 41 | 6c 6c 20 72 69 67 68 74 |Inc..#.A|ll right|
|000001a0| 73 20 72 65 73 65 72 76 | 65 64 2e 0d 23 0d 23 09 |s reserv|ed..#.#.|
|000001b0| 56 65 72 73 69 6f 6e 73 | 3a 09 0d 23 09 09 09 31 |Versions|:..#...1|
|000001c0| 2e 32 30 09 09 09 09 09 | 31 30 2f 38 39 0d 23 09 |.20.....|10/89.#.|
|000001d0| 09 09 31 2e 31 30 20 09 | 09 09 09 09 30 37 2f 38 |..1.10 .|....07/8|
|000001e0| 39 0d 23 09 09 09 31 2e | 30 30 20 09 09 09 09 09 |9.#...1.|00 .....|
|000001f0| 30 34 2f 38 39 0d 23 09 | 0d 23 09 43 6f 6d 70 6f |04/89.#.|.#.Compo|
|00000200| 6e 65 6e 74 73 3a 0d 23 | 09 09 09 43 50 6c 75 73 |nents:.#|...CPlus|
|00000210| 54 45 53 61 6d 70 6c 65 | 2e 6d 61 6b 65 09 09 4f |TESample|.make..O|
|00000220| 63 74 6f 62 65 72 20 31 | 2c 20 31 39 38 39 0d 23 |ctober 1|, 1989.#|
|00000230| 09 09 09 54 41 70 70 6c | 69 63 61 74 69 6f 6e 43 |...TAppl|icationC|
|00000240| 6f 6d 6d 6f 6e 2e 68 09 | 4f 63 74 6f 62 65 72 20 |ommon.h.|October |
|00000250| 31 2c 20 31 39 38 39 0d | 23 09 09 09 54 41 70 70 |1, 1989.|#...TApp|
|00000260| 6c 69 63 61 74 69 6f 6e | 2e 68 09 09 09 4f 63 74 |lication|.h...Oct|
|00000270| 6f 62 65 72 20 31 2c 20 | 31 39 38 39 0d 23 09 09 |ober 1, |1989.#..|
|00000280| 09 54 44 6f 63 75 6d 65 | 6e 74 2e 68 09 09 09 09 |.TDocume|nt.h....|
|00000290| 4f 63 74 6f 62 65 72 20 | 31 2c 20 31 39 38 39 0d |October |1, 1989.|
|000002a0| 23 09 09 09 54 45 43 6f | 6d 6d 6f 6e 2e 68 09 09 |#...TECo|mmon.h..|
|000002b0| 09 09 4f 63 74 6f 62 65 | 72 20 31 2c 20 31 39 38 |..Octobe|r 1, 198|
|000002c0| 39 0d 23 09 09 09 54 45 | 53 61 6d 70 6c 65 2e 68 |9.#...TE|Sample.h|
|000002d0| 09 09 09 09 4f 63 74 6f | 62 65 72 20 31 2c 20 31 |....Octo|ber 1, 1|
|000002e0| 39 38 39 0d 23 09 09 09 | 54 45 44 6f 63 75 6d 65 |989.#...|TEDocume|
|000002f0| 6e 74 2e 68 09 09 09 4f | 63 74 6f 62 65 72 20 31 |nt.h...O|ctober 1|
|00000300| 2c 20 31 39 38 39 0d 23 | 09 09 09 54 41 70 70 6c |, 1989.#|...TAppl|
|00000310| 69 63 61 74 69 6f 6e 2e | 63 70 09 09 09 4f 63 74 |ication.|cp...Oct|
|00000320| 6f 62 65 72 20 31 2c 20 | 31 39 38 39 0d 23 09 09 |ober 1, |1989.#..|
|00000330| 09 54 44 6f 63 75 6d 65 | 6e 74 2e 63 70 09 09 09 |.TDocume|nt.cp...|
|00000340| 4f 63 74 6f 62 65 72 20 | 31 2c 20 31 39 38 39 0d |October |1, 1989.|
|00000350| 23 09 09 09 54 45 53 61 | 6d 70 6c 65 2e 63 70 09 |#...TESa|mple.cp.|
|00000360| 09 09 09 4f 63 74 6f 62 | 65 72 20 31 2c 20 31 39 |...Octob|er 1, 19|
|00000370| 38 39 0d 23 09 09 09 54 | 45 44 6f 63 75 6d 65 6e |89.#...T|EDocumen|
|00000380| 74 2e 63 70 09 09 09 4f | 63 74 6f 62 65 72 20 31 |t.cp...O|ctober 1|
|00000390| 2c 20 31 39 38 39 0d 23 | 09 09 09 54 45 53 61 6d |, 1989.#|...TESam|
|000003a0| 70 6c 65 47 6c 75 65 2e | 61 09 09 09 4f 63 74 6f |pleGlue.|a...Octo|
|000003b0| 62 65 72 20 31 2c 20 31 | 39 38 39 0d 23 09 09 09 |ber 1, 1|989.#...|
|000003c0| 54 41 70 70 6c 69 63 61 | 74 69 6f 6e 2e 72 09 09 |TApplica|tion.r..|
|000003d0| 09 4f 63 74 6f 62 65 72 | 20 31 2c 20 31 39 38 39 |.October| 1, 1989|
|000003e0| 0d 23 09 09 09 54 45 53 | 61 6d 70 6c 65 2e 72 09 |.#...TES|ample.r.|
|000003f0| 09 09 09 4f 63 74 6f 62 | 65 72 20 31 2c 20 31 39 |...Octob|er 1, 19|
|00000400| 38 39 0d 23 0d 23 09 43 | 50 6c 75 73 54 45 53 61 |89.#.#.C|PlusTESa|
|00000410| 6d 70 6c 65 20 69 73 20 | 61 6e 20 65 78 61 6d 70 |mple is |an examp|
|00000420| 6c 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 74 |le appli|cation t|
|00000430| 68 61 74 20 64 65 6d 6f | 6e 73 74 72 61 74 65 73 |hat demo|nstrates|
|00000440| 0d 23 09 68 6f 77 20 74 | 6f 20 69 6e 69 74 69 61 |.#.how t|o initia|
|00000450| 6c 69 7a 65 20 74 68 65 | 20 63 6f 6d 6d 6f 6e 6c |lize the| commonl|
|00000460| 79 20 75 73 65 64 20 74 | 6f 6f 6c 62 6f 78 20 6d |y used t|oolbox m|
|00000470| 61 6e 61 67 65 72 73 2c | 0d 23 09 6f 70 65 72 61 |anagers,|.#.opera|
|00000480| 74 65 20 73 75 63 63 65 | 73 73 66 75 6c 6c 79 20 |te succe|ssfully |
|00000490| 75 6e 64 65 72 20 4d 75 | 6c 74 69 46 69 6e 64 65 |under Mu|ltiFinde|
|000004a0| 72 2c 20 68 61 6e 64 6c | 65 20 64 65 73 6b 0d 23 |r, handl|e desk.#|
|000004b0| 09 61 63 63 65 73 73 6f | 72 69 65 73 20 61 6e 64 |.accesso|ries and|
|000004c0| 20 63 72 65 61 74 65 2c | 20 67 72 6f 77 2c 20 61 | create,| grow, a|
|000004d0| 6e 64 20 7a 6f 6f 6d 20 | 77 69 6e 64 6f 77 73 2e |nd zoom |windows.|
|000004e0| 20 54 68 65 0d 23 09 66 | 75 6e 64 61 6d 65 6e 74 | The.#.f|undament|
|000004f0| 61 6c 20 54 65 78 74 45 | 64 69 74 20 74 6f 6f 6c |al TextE|dit tool|
|00000500| 62 6f 78 20 63 61 6c 6c | 73 20 61 6e 64 20 54 65 |box call|s and Te|
|00000510| 78 74 45 64 69 74 20 61 | 75 74 6f 73 63 72 6f 6c |xtEdit a|utoscrol|
|00000520| 6c 0d 23 09 61 72 65 20 | 64 65 6d 6f 6e 73 74 72 |l.#.are |demonstr|
|00000530| 61 74 65 64 2e 20 49 74 | 20 61 6c 73 6f 20 73 68 |ated. It| also sh|
|00000540| 6f 77 73 20 68 6f 77 20 | 74 6f 20 63 72 65 61 74 |ows how |to creat|
|00000550| 65 20 61 6e 64 20 6d 61 | 69 6e 74 61 69 6e 0d 23 |e and ma|intain.#|
|00000560| 09 73 63 72 6f 6c 6c 62 | 61 72 20 63 6f 6e 74 72 |.scrollb|ar contr|
|00000570| 6f 6c 73 2e 20 0d 23 0d | 23 09 54 68 69 73 20 76 |ols. .#.|#.This v|
|00000580| 65 72 73 69 6f 6e 20 6f | 66 20 54 45 53 61 6d 70 |ersion o|f TESamp|
|00000590| 6c 65 20 68 61 73 20 62 | 65 65 6e 20 73 75 62 73 |le has b|een subs|
|000005a0| 74 61 6e 74 69 61 6c 6c | 79 20 72 65 77 6f 72 6b |tantiall|y rework|
|000005b0| 65 64 20 69 6e 0d 23 09 | 43 2b 2b 20 74 6f 20 73 |ed in.#.|C++ to s|
|000005c0| 68 6f 77 20 68 6f 77 20 | 61 20 22 74 79 70 69 63 |how how |a "typic|
|000005d0| 61 6c 22 20 6f 62 6a 65 | 63 74 20 6f 72 69 65 6e |al" obje|ct orien|
|000005e0| 74 65 64 20 70 72 6f 67 | 72 61 6d 20 63 6f 75 6c |ted prog|ram coul|
|000005f0| 64 0d 23 09 62 65 20 77 | 72 69 74 74 65 6e 2e 20 |d.#.be w|ritten. |
|00000600| 54 6f 20 74 68 69 73 20 | 65 6e 64 2c 20 77 68 61 |To this |end, wha|
|00000610| 74 20 77 61 73 20 6f 6e | 63 65 20 61 20 73 69 6e |t was on|ce a sin|
|00000620| 67 6c 65 20 73 6f 75 72 | 63 65 20 63 6f 64 65 0d |gle sour|ce code.|
|00000630| 23 09 66 69 6c 65 20 68 | 61 73 20 62 65 65 6e 20 |#.file h|as been |
|00000640| 72 65 73 74 72 75 63 74 | 75 72 65 64 20 69 6e 74 |restruct|ured int|
|00000650| 6f 20 61 20 73 65 74 20 | 6f 66 20 63 6c 61 73 73 |o a set |of class|
|00000660| 65 73 20 77 68 69 63 68 | 0d 23 09 64 65 6d 6f 6e |es which|.#.demon|
|00000670| 73 74 72 61 74 65 20 74 | 68 65 20 61 64 76 61 6e |strate t|he advan|
|00000680| 74 61 67 65 73 20 6f 66 | 20 6f 62 6a 65 63 74 2d |tages of| object-|
|00000690| 6f 72 69 65 6e 74 65 64 | 20 70 72 6f 67 72 61 6d |oriented| program|
|000006a0| 6d 69 6e 67 2e 0d 23 0d | 2d 2d 2d 2d 2d 2d 2d 2d |ming..#.|--------|
|000006b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000006f0| 2d 2d 2d 2d 2d 2d 2a 2f | 0d 0d 0d 2f 2a 0d 53 65 |------*/|.../*.Se|
|00000700| 67 6d 65 6e 74 61 74 69 | 6f 6e 20 73 74 72 61 74 |gmentati|on strat|
|00000710| 65 67 79 3a 0d 0d 20 20 | 20 20 54 68 69 73 20 70 |egy:.. | This p|
|00000720| 72 6f 67 72 61 6d 20 68 | 61 73 20 6f 6e 6c 79 20 |rogram h|as only |
|00000730| 6f 6e 65 20 73 65 67 6d | 65 6e 74 2c 20 73 69 6e |one segm|ent, sin|
|00000740| 63 65 20 74 68 65 20 69 | 73 73 75 65 73 0d 20 20 |ce the i|ssues. |
|00000750| 20 20 73 75 72 72 6f 75 | 6e 64 69 6e 67 20 73 65 | surrou|nding se|
|00000760| 67 6d 65 6e 74 61 74 69 | 6f 6e 20 77 69 74 68 69 |gmentati|on withi|
|00000770| 6e 20 61 20 63 6c 61 73 | 73 27 73 20 6d 65 74 68 |n a clas|s's meth|
|00000780| 6f 64 73 20 68 61 76 65 | 0d 20 20 20 20 6e 6f 74 |ods have|. not|
|00000790| 20 62 65 65 6e 20 69 6e | 76 65 73 74 69 67 61 74 | been in|vestigat|
|000007a0| 65 64 20 79 65 74 2e 20 | 57 65 20 44 4f 20 75 6e |ed yet. |We DO un|
|000007b0| 6c 6f 61 64 20 74 68 65 | 20 64 61 74 61 0d 20 20 |load the| data. |
|000007c0| 20 20 69 6e 69 74 69 61 | 6c 69 7a 61 74 69 6f 6e | initia|lization|
|000007d0| 20 73 65 67 6d 65 6e 74 | 20 61 74 20 73 74 61 72 | segment| at star|
|000007e0| 74 75 70 20 74 69 6d 65 | 2c 20 77 68 69 63 68 20 |tup time|, which |
|000007f0| 66 72 65 65 73 20 75 70 | 0d 20 20 20 20 73 6f 6d |frees up|. som|
|00000800| 65 20 6d 65 6d 6f 72 79 | 20 0d 0d 53 65 74 50 6f |e memory| ..SetPo|
|00000810| 72 74 20 73 74 72 61 74 | 65 67 79 3a 0d 0d 20 20 |rt strat|egy:.. |
|00000820| 20 20 54 6f 6f 6c 62 6f | 78 20 72 6f 75 74 69 6e | Toolbo|x routin|
|00000830| 65 73 20 64 6f 20 6e 6f | 74 20 63 68 61 6e 67 65 |es do no|t change|
|00000840| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 70 6f 72 | the cur|rent por|
|00000850| 74 2e 20 49 6e 0d 20 20 | 20 20 73 70 69 74 65 20 |t. In. | spite |
|00000860| 6f 66 20 74 68 69 73 2c | 20 69 6e 20 74 68 69 73 |of this,| in this|
|00000870| 20 70 72 6f 67 72 61 6d | 20 77 65 20 75 73 65 20 | program| we use |
|00000880| 61 20 73 74 72 61 74 65 | 67 79 20 6f 66 0d 20 20 |a strate|gy of. |
|00000890| 20 20 63 61 6c 6c 69 6e | 67 20 53 65 74 50 6f 72 | callin|g SetPor|
|000008a0| 74 20 77 68 65 6e 65 76 | 65 72 20 77 65 20 77 61 |t whenev|er we wa|
|000008b0| 6e 74 20 74 6f 20 64 72 | 61 77 20 6f 72 20 6d 61 |nt to dr|aw or ma|
|000008c0| 6b 65 20 63 61 6c 6c 73 | 0d 20 20 20 20 77 68 69 |ke calls|. whi|
|000008d0| 63 68 20 64 65 70 65 6e | 64 20 6f 6e 20 74 68 65 |ch depen|d on the|
|000008e0| 20 63 75 72 72 65 6e 74 | 20 70 6f 72 74 2e 20 54 | current| port. T|
|000008f0| 68 69 73 20 6d 61 6b 65 | 73 20 75 73 20 6c 65 73 |his make|s us les|
|00000900| 73 0d 20 20 20 20 76 75 | 6c 6e 65 72 61 62 6c 65 |s. vu|lnerable|
|00000910| 20 74 6f 20 62 75 67 73 | 20 69 6e 20 6f 74 68 65 | to bugs| in othe|
|00000920| 72 20 73 6f 66 74 77 61 | 72 65 20 77 68 69 63 68 |r softwa|re which|
|00000930| 20 6d 69 67 68 74 20 61 | 6c 74 65 72 0d 20 20 20 | might a|lter. |
|00000940| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 70 6f 72 | the cur|rent por|
|00000950| 74 20 28 73 75 63 68 20 | 61 73 20 74 68 65 20 62 |t (such |as the b|
|00000960| 75 67 20 28 66 65 61 74 | 75 72 65 3f 29 20 69 6e |ug (feat|ure?) in|
|00000970| 20 6d 61 6e 79 0d 20 20 | 20 20 64 65 73 6b 20 61 | many. | desk a|
|00000980| 63 63 65 73 73 6f 72 69 | 65 73 20 77 68 69 63 68 |ccessori|es which|
|00000990| 20 63 68 61 6e 67 65 20 | 74 68 65 20 70 6f 72 74 | change |the port|
|000009a0| 20 6f 6e 20 4f 70 65 6e | 44 65 73 6b 41 63 63 29 | on Open|DeskAcc)|
|000009b0| 2e 0d 20 20 20 20 48 6f | 70 65 66 75 6c 6c 79 2c |.. Ho|pefully,|
|000009c0| 20 74 68 69 73 20 61 6c | 73 6f 20 6d 61 6b 65 73 | this al|so makes|
|000009d0| 20 74 68 65 20 72 6f 75 | 74 69 6e 65 73 20 66 72 | the rou|tines fr|
|000009e0| 6f 6d 20 74 68 69 73 0d | 20 20 20 20 70 72 6f 67 |om this.| prog|
|000009f0| 72 61 6d 20 6d 6f 72 65 | 20 73 65 6c 66 2d 63 6f |ram more| self-co|
|00000a00| 6e 74 61 69 6e 65 64 2c | 20 73 69 6e 63 65 20 74 |ntained,| since t|
|00000a10| 68 65 79 20 64 6f 6e 27 | 74 20 64 65 70 65 6e 64 |hey don'|t depend|
|00000a20| 20 6f 6e 0d 20 20 20 20 | 74 68 65 20 63 75 72 72 | on. |the curr|
|00000a30| 65 6e 74 20 70 6f 72 74 | 20 73 65 74 74 69 6e 67 |ent port| setting|
|00000a40| 2e 20 0d 0d 43 6c 69 70 | 62 6f 61 72 64 20 73 74 |. ..Clip|board st|
|00000a50| 72 61 74 65 67 79 3a 0d | 0d 20 20 20 20 54 68 69 |rategy:.|. Thi|
|00000a60| 73 20 70 72 6f 67 72 61 | 6d 20 64 6f 65 73 20 6e |s progra|m does n|
|00000a70| 6f 74 20 6d 61 69 6e 74 | 61 69 6e 20 61 20 70 72 |ot maint|ain a pr|
|00000a80| 69 76 61 74 65 20 73 63 | 72 61 70 2e 0d 20 20 20 |ivate sc|rap.. |
|00000a90| 20 57 68 65 6e 65 76 65 | 72 20 61 20 63 75 74 2c | Wheneve|r a cut,|
|00000aa0| 20 63 6f 70 79 2c 20 6f | 72 20 70 61 73 74 65 20 | copy, o|r paste |
|00000ab0| 6f 63 63 75 72 73 2c 20 | 77 65 20 69 6d 70 6f 72 |occurs, |we impor|
|00000ac0| 74 2f 65 78 70 6f 72 74 | 0d 20 20 20 20 66 72 6f |t/export|. fro|
|00000ad0| 6d 20 74 68 65 20 70 75 | 62 6c 69 63 20 73 63 72 |m the pu|blic scr|
|00000ae0| 61 70 20 74 6f 20 54 65 | 78 74 45 64 69 74 27 73 |ap to Te|xtEdit's|
|00000af0| 20 73 63 72 61 70 20 72 | 69 67 68 74 20 61 77 61 | scrap r|ight awa|
|00000b00| 79 2c 0d 20 20 20 20 75 | 73 69 6e 67 20 74 68 65 |y,. u|sing the|
|00000b10| 20 54 45 54 6f 53 63 72 | 61 70 20 61 6e 64 20 54 | TEToScr|ap and T|
|00000b20| 45 46 72 6f 6d 53 63 72 | 61 70 20 72 6f 75 74 69 |EFromScr|ap routi|
|00000b30| 6e 65 73 2e 20 49 66 20 | 77 65 20 64 69 64 0d 20 |nes. If |we did. |
|00000b40| 20 20 20 75 73 65 20 61 | 20 70 72 69 76 61 74 65 | use a| private|
|00000b50| 20 73 63 72 61 70 2c 20 | 74 68 65 20 69 6d 70 6f | scrap, |the impo|
|00000b60| 72 74 2f 65 78 70 6f 72 | 74 20 77 6f 75 6c 64 20 |rt/expor|t would |
|00000b70| 62 65 20 69 6e 20 74 68 | 65 0d 20 20 20 20 61 63 |be in th|e. ac|
|00000b80| 74 69 76 61 74 65 2f 64 | 65 61 63 74 69 76 61 74 |tivate/d|eactivat|
|00000b90| 65 20 65 76 65 6e 74 20 | 61 6e 64 20 73 75 73 70 |e event |and susp|
|00000ba0| 65 6e 64 2f 72 65 73 75 | 6d 65 20 65 76 65 6e 74 |end/resu|me event|
|00000bb0| 0d 20 20 20 20 72 6f 75 | 74 69 6e 65 73 2e 20 0d |. rou|tines. .|
|00000bc0| 2a 2f 0d 0d 2f 2f 20 4d | 61 63 20 49 6e 63 6c 75 |*/..// M|ac Inclu|
|00000bd0| 64 65 73 0d 23 69 6e 63 | 6c 75 64 65 20 3c 54 79 |des.#inc|lude <Ty|
|00000be0| 70 65 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |pes.h>.#|include |
|00000bf0| 3c 51 75 69 63 6b 44 72 | 61 77 2e 68 3e 0d 23 69 |<QuickDr|aw.h>.#i|
|00000c00| 6e 63 6c 75 64 65 20 3c | 46 6f 6e 74 73 2e 68 3e |nclude <|Fonts.h>|
|00000c10| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 45 76 65 6e 74 |.#includ|e <Event|
|00000c20| 73 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 43 |s.h>.#in|clude <C|
|00000c30| 6f 6e 74 72 6f 6c 73 2e | 68 3e 0d 23 69 6e 63 6c |ontrols.|h>.#incl|
|00000c40| 75 64 65 20 3c 57 69 6e | 64 6f 77 73 2e 68 3e 0d |ude <Win|dows.h>.|
|00000c50| 23 69 6e 63 6c 75 64 65 | 20 3c 4d 65 6e 75 73 2e |#include| <Menus.|
|00000c60| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 65 78 |h>.#incl|ude <Tex|
|00000c70| 74 45 64 69 74 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |tEdit.h>|.#includ|
|00000c80| 65 20 3c 44 69 61 6c 6f | 67 73 2e 68 3e 0d 23 69 |e <Dialo|gs.h>.#i|
|00000c90| 6e 63 6c 75 64 65 20 3c | 44 65 73 6b 2e 68 3e 0d |nclude <|Desk.h>.|
|00000ca0| 23 69 6e 63 6c 75 64 65 | 20 3c 53 63 72 61 70 2e |#include| <Scrap.|
|00000cb0| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 6f 6f |h>.#incl|ude <Too|
|00000cc0| 6c 55 74 69 6c 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |lUtils.h|>.#inclu|
|00000cd0| 64 65 20 3c 4d 65 6d 6f | 72 79 2e 68 3e 0d 23 69 |de <Memo|ry.h>.#i|
|00000ce0| 6e 63 6c 75 64 65 20 3c | 53 65 67 4c 6f 61 64 2e |nclude <|SegLoad.|
|00000cf0| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 46 69 6c |h>.#incl|ude <Fil|
|00000d00| 65 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |es.h>.#i|nclude <|
|00000d10| 4f 53 55 74 69 6c 73 2e | 68 3e 0d 23 69 6e 63 6c |OSUtils.|h>.#incl|
|00000d20| 75 64 65 20 3c 54 72 61 | 70 73 2e 68 3e 0d 0d 23 |ude <Tra|ps.h>..#|
|00000d30| 69 6e 63 6c 75 64 65 20 | 22 54 45 44 6f 63 75 6d |include |"TEDocum|
|00000d40| 65 6e 74 2e 68 22 0d 23 | 69 6e 63 6c 75 64 65 20 |ent.h".#|include |
|00000d50| 22 54 45 53 61 6d 70 6c | 65 2e 68 22 0d 0d 65 78 |"TESampl|e.h"..ex|
|00000d60| 74 65 72 6e 20 22 43 22 | 20 7b 20 0d 09 2f 2f 20 |tern "C"| { ..// |
|00000d70| 70 72 6f 74 6f 74 79 70 | 65 73 20 66 6f 72 20 66 |prototyp|es for f|
|00000d80| 75 6e 63 74 69 6f 6e 73 | 20 74 68 61 74 20 64 6f |unctions| that do|
|00000d90| 6e 27 74 20 62 65 6c 6f | 6e 67 20 74 6f 20 61 6e |n't belo|ng to an|
|00000da0| 79 20 6f 6e 65 20 63 6c | 61 73 73 0d 09 70 61 73 |y one cl|ass..pas|
|00000db0| 63 61 6c 20 43 6c 69 6b | 4c 6f 6f 70 50 72 6f 63 |cal Clik|LoopProc|
|00000dc0| 50 74 72 20 47 65 74 4f | 6c 64 43 6c 69 6b 4c 6f |Ptr GetO|ldClikLo|
|00000dd0| 6f 70 28 29 3b 0d 09 70 | 61 73 63 61 6c 20 76 6f |op();..p|ascal vo|
|00000de0| 69 64 20 50 61 73 63 61 | 6c 43 6c 69 6b 4c 6f 6f |id Pasca|lClikLoo|
|00000df0| 70 28 29 3b 0d 09 76 6f | 69 64 20 43 6f 6d 6d 6f |p();..vo|id Commo|
|00000e00| 6e 41 63 74 69 6f 6e 28 | 43 6f 6e 74 72 6f 6c 48 |nAction(|ControlH|
|00000e10| 61 6e 64 6c 65 20 63 6f | 6e 74 72 6f 6c 2c 73 68 |andle co|ntrol,sh|
|00000e20| 6f 72 74 2a 20 61 6d 6f | 75 6e 74 29 3b 0d 09 70 |ort* amo|unt);..p|
|00000e30| 61 73 63 61 6c 20 76 6f | 69 64 20 56 41 63 74 69 |ascal vo|id VActi|
|00000e40| 6f 6e 50 72 6f 63 28 43 | 6f 6e 74 72 6f 6c 48 61 |onProc(C|ontrolHa|
|00000e50| 6e 64 6c 65 20 63 6f 6e | 74 72 6f 6c 2c 73 68 6f |ndle con|trol,sho|
|00000e60| 72 74 20 70 61 72 74 29 | 3b 0d 09 70 61 73 63 61 |rt part)|;..pasca|
|00000e70| 6c 20 76 6f 69 64 20 48 | 41 63 74 69 6f 6e 50 72 |l void H|ActionPr|
|00000e80| 6f 63 28 43 6f 6e 74 72 | 6f 6c 48 61 6e 64 6c 65 |oc(Contr|olHandle|
|00000e90| 20 63 6f 6e 74 72 6f 6c | 2c 73 68 6f 72 74 20 70 | control|,short p|
|00000ea0| 61 72 74 29 3b 0d 09 2f | 2f 20 74 68 69 73 20 72 |art);../|/ this r|
|00000eb0| 6f 75 74 69 6e 65 20 69 | 73 20 77 72 69 74 74 65 |outine i|s writte|
|00000ec0| 6e 20 69 6e 20 41 73 73 | 65 6d 62 6c 65 72 2c 20 |n in Ass|embler, |
|00000ed0| 73 69 6e 63 65 20 69 74 | 20 6e 65 65 64 73 20 74 |since it| needs t|
|00000ee0| 6f 20 74 77 65 61 6b 20 | 72 65 67 69 73 74 65 72 |o tweak |register|
|00000ef0| 73 0d 09 70 61 73 63 61 | 6c 20 76 6f 69 64 20 41 |s..pasca|l void A|
|00000f00| 53 4d 43 4c 49 4b 4c 4f | 4f 50 28 29 3b 0d 7d 3b |SMCLIKLO|OP();.};|
|00000f10| 0d 0d 2f 2f 20 6b 54 65 | 78 74 4d 61 72 67 69 6e |..// kTe|xtMargin|
|00000f20| 20 69 73 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f | is the |number o|
|00000f30| 66 20 70 69 78 65 6c 73 | 20 77 65 20 6c 65 61 76 |f pixels| we leav|
|00000f40| 65 20 62 6c 61 6e 6b 20 | 61 74 20 74 68 65 20 65 |e blank |at the e|
|00000f50| 64 67 65 20 6f 66 20 74 | 68 65 20 77 69 6e 64 6f |dge of t|he windo|
|00000f60| 77 2e 0d 63 6f 6e 73 74 | 20 73 68 6f 72 74 20 6b |w..const| short k|
|00000f70| 54 65 78 74 4d 61 72 67 | 69 6e 20 3d 20 32 3b 0d |TextMarg|in = 2;.|
|00000f80| 0d 2f 2f 20 6b 4d 61 78 | 44 6f 63 57 69 64 74 68 |.// kMax|DocWidth|
|00000f90| 20 69 73 20 61 6e 20 61 | 72 62 69 74 72 61 72 79 | is an a|rbitrary|
|00000fa0| 20 6e 75 6d 62 65 72 20 | 75 73 65 64 20 74 6f 20 | number |used to |
|00000fb0| 73 70 65 63 69 66 79 20 | 74 68 65 20 77 69 64 74 |specify |the widt|
|00000fc0| 68 20 6f 66 20 74 68 65 | 20 54 45 52 65 63 27 73 |h of the| TERec's|
|00000fd0| 0d 2f 2f 20 64 65 73 74 | 69 6e 61 74 69 6f 6e 20 |.// dest|ination |
|00000fe0| 72 65 63 74 61 6e 67 6c | 65 20 73 6f 20 74 68 61 |rectangl|e so tha|
|00000ff0| 74 20 77 6f 72 64 20 77 | 72 61 70 20 61 6e 64 20 |t word w|rap and |
|00001000| 68 6f 72 69 7a 6f 6e 74 | 61 6c 20 73 63 72 6f 6c |horizont|al scrol|
|00001010| 6c 69 6e 67 20 63 61 6e | 20 62 65 0d 2f 2f 20 64 |ling can| be.// d|
|00001020| 65 6d 6f 6e 73 74 72 61 | 74 65 64 2e 0d 63 6f 6e |emonstra|ted..con|
|00001030| 73 74 20 73 68 6f 72 74 | 09 6b 4d 61 78 44 6f 63 |st short|.kMaxDoc|
|00001040| 57 69 64 74 68 20 3d 20 | 35 37 36 3b 0d 09 0d 2f |Width = |576;.../|
|00001050| 2f 20 6b 4d 69 6e 44 6f | 63 44 69 6d 20 69 73 20 |/ kMinDo|cDim is |
|00001060| 75 73 65 64 20 74 6f 20 | 6c 69 6d 69 74 20 74 68 |used to |limit th|
|00001070| 65 20 6d 69 6e 69 6d 75 | 6d 20 64 69 6d 65 6e 73 |e minimu|m dimens|
|00001080| 69 6f 6e 20 6f 66 20 61 | 20 77 69 6e 64 6f 77 20 |ion of a| window |
|00001090| 77 68 65 6e 20 47 72 6f | 77 57 69 6e 64 6f 77 0d |when Gro|wWindow.|
|000010a0| 2f 2f 20 69 73 20 63 61 | 6c 6c 65 64 2e 0d 63 6f |// is ca|lled..co|
|000010b0| 6e 73 74 20 73 68 6f 72 | 74 09 6b 4d 69 6e 44 6f |nst shor|t.kMinDo|
|000010c0| 63 44 69 6d 20 3d 20 36 | 34 3b 0d 09 0d 2f 2f 20 |cDim = 6|4;...// |
|000010d0| 6b 4d 61 78 54 45 4c 65 | 6e 67 74 68 20 69 73 20 |kMaxTELe|ngth is |
|000010e0| 61 6e 20 61 72 62 69 74 | 72 61 72 79 20 6e 75 6d |an arbit|rary num|
|000010f0| 62 65 72 20 75 73 65 64 | 20 74 6f 20 6c 69 6d 69 |ber used| to limi|
|00001100| 74 20 74 68 65 20 6c 65 | 6e 67 74 68 20 6f 66 20 |t the le|ngth of |
|00001110| 74 65 78 74 20 69 6e 20 | 74 68 65 20 54 45 52 65 |text in |the TERe|
|00001120| 63 0d 2f 2f 20 73 6f 20 | 74 68 61 74 20 76 61 72 |c.// so |that var|
|00001130| 69 6f 75 73 20 65 72 72 | 6f 72 73 20 77 6f 6e 27 |ious err|ors won'|
|00001140| 74 20 6f 63 63 75 72 20 | 66 72 6f 6d 20 74 6f 6f |t occur |from too|
|00001150| 20 6d 61 6e 79 20 63 68 | 61 72 61 63 74 65 72 73 | many ch|aracters|
|00001160| 20 62 65 69 6e 67 20 69 | 6e 20 74 68 65 20 74 65 | being i|n the te|
|00001170| 78 74 2e 0d 63 6f 6e 73 | 74 20 73 68 6f 72 74 09 |xt..cons|t short.|
|00001180| 6b 4d 61 78 54 45 4c 65 | 6e 67 74 68 20 3d 20 33 |kMaxTELe|ngth = 3|
|00001190| 32 30 30 30 3b 0d 0d 2f | 2f 20 6b 43 6f 6e 74 72 |2000;../|/ kContr|
|000011a0| 6f 6c 49 6e 76 69 73 69 | 62 6c 65 20 69 73 20 75 |olInvisi|ble is u|
|000011b0| 73 65 64 20 74 68 65 20 | 73 61 6d 65 20 77 61 79 |sed the |same way|
|000011c0| 20 74 6f 20 27 74 75 72 | 6e 20 6f 6e 27 20 74 68 | to 'tur|n on' th|
|000011d0| 65 20 63 6f 6e 74 72 6f | 6c 2e 0d 63 6f 6e 73 74 |e contro|l..const|
|000011e0| 20 73 68 6f 72 74 20 6b | 43 6f 6e 74 72 6f 6c 56 | short k|ControlV|
|000011f0| 69 73 69 62 6c 65 20 3d | 20 30 78 46 46 3b 0d 0d |isible =| 0xFF;..|
|00001200| 2f 2f 20 53 63 72 6f 6c | 6c 42 61 72 41 64 6a 75 |// Scrol|lBarAdju|
|00001210| 73 74 2c 20 47 72 6f 77 | 42 6f 78 41 64 6a 75 73 |st, Grow|BoxAdjus|
|00001220| 74 2c 20 61 6e 64 20 53 | 63 72 6f 6c 6c 42 61 72 |t, and S|crollBar|
|00001230| 20 77 69 64 74 68 20 61 | 72 65 20 75 73 65 64 20 | width a|re used |
|00001240| 69 6e 20 63 61 6c 63 75 | 6c 61 74 69 6e 67 0d 2f |in calcu|lating./|
|00001250| 2f 20 76 61 6c 75 65 73 | 20 66 6f 72 20 63 6f 6e |/ values| for con|
|00001260| 74 72 6f 6c 20 70 6f 73 | 69 74 69 6f 6e 69 6e 67 |trol pos|itioning|
|00001270| 20 61 6e 64 20 73 69 7a | 69 6e 67 2e 0d 63 6f 6e | and siz|ing..con|
|00001280| 73 74 20 73 68 6f 72 74 | 20 6b 53 63 72 6f 6c 6c |st short| kScroll|
|00001290| 62 61 72 41 64 6a 75 73 | 74 20 3d 20 31 35 3b 0d |barAdjus|t = 15;.|
|000012a0| 63 6f 6e 73 74 20 73 68 | 6f 72 74 20 6b 47 72 6f |const sh|ort kGro|
|000012b0| 77 62 6f 78 41 64 6a 75 | 73 74 20 3d 20 31 35 3b |wboxAdju|st = 15;|
|000012c0| 0d 63 6f 6e 73 74 20 73 | 68 6f 72 74 20 6b 53 63 |.const s|hort kSc|
|000012d0| 72 6f 6c 6c 62 61 72 57 | 69 64 74 68 20 3d 20 31 |rollbarW|idth = 1|
|000012e0| 36 3b 0d 0d 2f 2f 20 6b | 54 45 53 6c 6f 70 20 70 |6;..// k|TESlop p|
|000012f0| 72 6f 76 69 64 65 73 20 | 73 6f 6d 65 20 65 78 74 |rovides |some ext|
|00001300| 72 61 20 73 65 63 75 72 | 69 74 79 20 77 68 65 6e |ra secur|ity when|
|00001310| 20 70 72 65 2d 66 6c 69 | 67 68 74 69 6e 67 20 65 | pre-fli|ghting e|
|00001320| 64 69 74 20 63 6f 6d 6d | 61 6e 64 73 2e 0d 63 6f |dit comm|ands..co|
|00001330| 6e 73 74 20 73 68 6f 72 | 74 20 6b 54 45 53 6c 6f |nst shor|t kTESlo|
|00001340| 70 20 3d 20 31 30 32 34 | 3b 0d 0d 2f 2f 20 6b 53 |p = 1024|;..// kS|
|00001350| 63 72 6f 6c 6c 54 77 65 | 65 6b 20 63 6f 6d 70 65 |crollTwe|ek compe|
|00001360| 6e 73 61 74 65 73 20 66 | 6f 72 20 6f 66 66 2d 62 |nsates f|or off-b|
|00001370| 79 2d 6f 6e 65 20 72 65 | 71 75 69 72 65 6d 65 6e |y-one re|quiremen|
|00001380| 74 73 20 6f 66 20 74 68 | 65 20 73 63 72 6f 6c 6c |ts of th|e scroll|
|00001390| 62 61 72 73 0d 2f 2f 20 | 74 6f 20 68 61 76 65 20 |bars.// |to have |
|000013a0| 62 6f 72 64 65 72 73 20 | 63 6f 69 6e 63 69 64 65 |borders |coincide|
|000013b0| 20 77 69 74 68 20 74 68 | 65 20 67 72 6f 77 62 6f | with th|e growbo|
|000013c0| 78 2e 0d 63 6f 6e 73 74 | 20 73 68 6f 72 74 20 6b |x..const| short k|
|000013d0| 53 63 72 6f 6c 6c 54 77 | 65 65 6b 20 3d 20 32 3b |ScrollTw|eek = 2;|
|000013e0| 0d 09 0d 2f 2f 20 6b 43 | 72 43 68 61 72 20 69 73 |...// kC|rChar is|
|000013f0| 20 75 73 65 64 20 74 6f | 20 6d 61 74 63 68 20 77 | used to| match w|
|00001400| 69 74 68 20 61 20 63 61 | 72 72 69 61 67 65 20 72 |ith a ca|rriage r|
|00001410| 65 74 75 72 6e 20 77 68 | 65 6e 20 63 61 6c 63 75 |eturn wh|en calcu|
|00001420| 6c 61 74 69 6e 67 20 74 | 68 65 0d 2f 2f 20 6e 75 |lating t|he.// nu|
|00001430| 6d 62 65 72 20 6f 66 20 | 6c 69 6e 65 73 20 69 6e |mber of |lines in|
|00001440| 20 74 68 65 20 54 65 78 | 74 45 64 69 74 20 72 65 | the Tex|tEdit re|
|00001450| 63 6f 72 64 2e 20 6b 44 | 65 6c 43 68 61 72 20 69 |cord. kD|elChar i|
|00001460| 73 20 75 73 65 64 20 74 | 6f 20 63 68 65 63 6b 20 |s used t|o check |
|00001470| 66 6f 72 0d 2f 2f 20 64 | 65 6c 65 74 65 20 69 6e |for.// d|elete in|
|00001480| 20 6b 65 79 44 6f 77 6e | 73 2e 0d 63 6f 6e 73 74 | keyDown|s..const|
|00001490| 20 73 68 6f 72 74 20 6b | 43 72 43 68 61 72 20 3d | short k|CrChar =|
|000014a0| 20 31 33 3b 0d 63 6f 6e | 73 74 20 73 68 6f 72 74 | 13;.con|st short|
|000014b0| 20 6b 44 65 6c 43 68 61 | 72 20 3d 20 38 3b 0d 0d | kDelCha|r = 8;..|
|000014c0| 2f 2f 20 6e 6f 74 69 63 | 65 20 74 68 61 74 20 77 |// notic|e that w|
|000014d0| 65 20 70 61 73 73 20 74 | 68 65 20 72 65 73 49 44 |e pass t|he resID|
|000014e0| 20 70 61 72 61 6d 65 74 | 65 72 20 75 70 20 74 6f | paramet|er up to|
|000014f0| 20 6f 75 72 20 62 61 73 | 65 20 63 6c 61 73 73 2c | our bas|e class,|
|00001500| 0d 2f 2f 20 77 68 69 63 | 68 20 61 63 74 75 61 6c |.// whic|h actual|
|00001510| 6c 79 20 63 72 65 61 74 | 65 73 20 74 68 65 20 77 |ly creat|es the w|
|00001520| 69 6e 64 6f 77 20 66 6f | 72 20 75 73 0d 54 45 44 |indow fo|r us.TED|
|00001530| 6f 63 75 6d 65 6e 74 3a | 3a 54 45 44 6f 63 75 6d |ocument:|:TEDocum|
|00001540| 65 6e 74 28 73 68 6f 72 | 74 20 72 65 73 49 44 29 |ent(shor|t resID)|
|00001550| 09 3a 20 28 72 65 73 49 | 44 29 0d 7b 0d 09 42 6f |.: (resI|D).{..Bo|
|00001560| 6f 6c 65 61 6e 20 67 6f | 6f 64 3b 0d 09 52 65 63 |olean go|od;..Rec|
|00001570| 74 20 64 65 73 74 52 65 | 63 74 2c 20 76 69 65 77 |t destRe|ct, view|
|00001580| 52 65 63 74 3b 0d 0d 09 | 67 6f 6f 64 20 3d 20 66 |Rect;...|good = f|
|00001590| 61 6c 73 65 3b 0d 09 53 | 65 74 50 6f 72 74 28 66 |alse;..S|etPort(f|
|000015a0| 44 6f 63 57 69 6e 64 6f | 77 29 3b 0d 09 47 65 74 |DocWindo|w);..Get|
|000015b0| 54 45 52 65 63 74 28 26 | 76 69 65 77 52 65 63 74 |TERect(&|viewRect|
|000015c0| 29 3b 0d 09 64 65 73 74 | 52 65 63 74 20 3d 20 76 |);..dest|Rect = v|
|000015d0| 69 65 77 52 65 63 74 3b | 0d 09 64 65 73 74 52 65 |iewRect;|..destRe|
|000015e0| 63 74 2e 72 69 67 68 74 | 20 3d 20 64 65 73 74 52 |ct.right| = destR|
|000015f0| 65 63 74 2e 6c 65 66 74 | 20 2b 20 6b 4d 61 78 44 |ect.left| + kMaxD|
|00001600| 6f 63 57 69 64 74 68 3b | 0d 09 66 44 6f 63 54 45 |ocWidth;|..fDocTE|
|00001610| 20 3d 20 54 45 4e 65 77 | 28 26 64 65 73 74 52 65 | = TENew|(&destRe|
|00001620| 63 74 2c 20 26 76 69 65 | 77 52 65 63 74 29 3b 0d |ct, &vie|wRect);.|
|00001630| 09 0d 09 67 6f 6f 64 20 | 3d 20 66 44 6f 63 54 45 |...good |= fDocTE|
|00001640| 20 21 3d 20 6e 69 6c 3b | 09 2f 2f 20 69 66 20 54 | != nil;|.// if T|
|00001650| 45 4e 65 77 20 73 75 63 | 63 65 65 64 65 64 2c 20 |ENew suc|ceeded, |
|00001660| 77 65 20 68 61 76 65 20 | 61 20 67 6f 6f 64 20 64 |we have |a good d|
|00001670| 6f 63 75 6d 65 6e 74 20 | 0d 0d 09 69 66 20 28 20 |ocument |...if ( |
|00001680| 67 6f 6f 64 20 29 0d 09 | 20 20 7b 0d 09 09 2f 2f |good )..| {...//|
|00001690| 20 73 65 74 20 75 70 20 | 54 45 20 72 65 63 6f 72 | set up |TE recor|
|000016a0| 64 0d 09 09 41 64 6a 75 | 73 74 56 69 65 77 52 65 |d...Adju|stViewRe|
|000016b0| 63 74 28 29 3b 0d 09 09 | 54 45 41 75 74 6f 56 69 |ct();...|TEAutoVi|
|000016c0| 65 77 28 74 72 75 65 2c | 20 66 44 6f 63 54 45 29 |ew(true,| fDocTE)|
|000016d0| 3b 0d 09 09 66 44 6f 63 | 43 6c 69 6b 20 3d 20 28 |;...fDoc|Clik = (|
|000016e0| 2a 66 44 6f 63 54 45 29 | 2d 3e 63 6c 69 6b 4c 6f |*fDocTE)|->clikLo|
|000016f0| 6f 70 3b 0d 09 09 28 2a | 66 44 6f 63 54 45 29 2d |op;...(*|fDocTE)-|
|00001700| 3e 63 6c 69 6b 4c 6f 6f | 70 20 3d 20 28 43 6c 69 |>clikLoo|p = (Cli|
|00001710| 6b 4c 6f 6f 70 50 72 6f | 63 50 74 72 29 20 41 53 |kLoopPro|cPtr) AS|
|00001720| 4d 43 4c 49 4b 4c 4f 4f | 50 3b 0d 0d 09 09 2f 2f |MCLIKLOO|P;....//|
|00001730| 20 67 65 74 20 76 65 72 | 74 69 63 61 6c 20 73 63 | get ver|tical sc|
|00001740| 72 6f 6c 6c 62 61 72 0d | 09 09 66 44 6f 63 56 53 |rollbar.|..fDocVS|
|00001750| 63 72 6f 6c 6c 20 3d 20 | 47 65 74 4e 65 77 43 6f |croll = |GetNewCo|
|00001760| 6e 74 72 6f 6c 28 72 56 | 53 63 72 6f 6c 6c 2c 20 |ntrol(rV|Scroll, |
|00001770| 66 44 6f 63 57 69 6e 64 | 6f 77 29 3b 0d 09 09 67 |fDocWind|ow);...g|
|00001780| 6f 6f 64 20 3d 20 28 66 | 44 6f 63 56 53 63 72 6f |ood = (f|DocVScro|
|00001790| 6c 6c 20 21 3d 20 6e 69 | 6c 29 3b 0d 09 20 20 7d |ll != ni|l);.. }|
|000017a0| 0d 09 69 66 20 28 20 67 | 6f 6f 64 29 0d 09 20 20 |..if ( g|ood).. |
|000017b0| 7b 0d 09 09 66 44 6f 63 | 48 53 63 72 6f 6c 6c 20 |{...fDoc|HScroll |
|000017c0| 3d 20 47 65 74 4e 65 77 | 43 6f 6e 74 72 6f 6c 28 |= GetNew|Control(|
|000017d0| 72 48 53 63 72 6f 6c 6c | 2c 20 66 44 6f 63 57 69 |rHScroll|, fDocWi|
|000017e0| 6e 64 6f 77 29 3b 0d 09 | 09 67 6f 6f 64 20 3d 20 |ndow);..|.good = |
|000017f0| 28 66 44 6f 63 48 53 63 | 72 6f 6c 6c 20 21 3d 20 |(fDocHSc|roll != |
|00001800| 6e 69 6c 29 3b 0d 09 20 | 20 7d 0d 09 0d 09 69 66 |nil);.. | }....if|
|00001810| 20 28 20 67 6f 6f 64 20 | 29 09 09 09 09 2f 2f 20 | ( good |)....// |
|00001820| 67 6f 6f 64 3f 20 d1 20 | 61 64 6a 75 73 74 20 26 |good? . |adjust &|
|00001830| 20 64 72 61 77 20 74 68 | 65 20 63 6f 6e 74 72 6f | draw th|e contro|
|00001840| 6c 73 2c 20 64 72 61 77 | 20 74 68 65 20 77 69 6e |ls, draw| the win|
|00001850| 64 6f 77 0d 09 20 20 7b | 0d 09 09 41 64 6a 75 73 |dow.. {|...Adjus|
|00001860| 74 53 63 72 6f 6c 6c 56 | 61 6c 75 65 73 28 74 72 |tScrollV|alues(tr|
|00001870| 75 65 29 3b 0d 09 09 53 | 68 6f 77 57 69 6e 64 6f |ue);...S|howWindo|
|00001880| 77 28 66 44 6f 63 57 69 | 6e 64 6f 77 29 3b 0d 09 |w(fDocWi|ndow);..|
|00001890| 20 20 7d 0d 09 65 6c 73 | 65 0d 09 20 20 7b 0d 09 | }..els|e.. {..|
|000018a0| 09 2f 2f 20 74 65 6c 6c | 20 75 73 65 72 20 77 65 |.// tell| user we|
|000018b0| 20 66 61 69 6c 65 64 0d | 09 09 41 6c 65 72 74 55 | failed.|..AlertU|
|000018c0| 73 65 72 28 6b 54 45 44 | 6f 63 45 72 72 53 74 72 |ser(kTED|ocErrStr|
|000018d0| 69 6e 67 73 2c 65 4e 6f | 57 69 6e 64 6f 77 29 3b |ings,eNo|Window);|
|000018e0| 20 0d 09 20 20 7d 0d 7d | 0d 0d 2f 2f 20 41 74 20 | .. }.}|..// At |
|000018f0| 74 68 69 73 20 70 6f 69 | 6e 74 2c 20 69 66 20 74 |this poi|nt, if t|
|00001900| 68 65 72 65 20 77 61 73 | 20 61 20 64 6f 63 75 6d |here was| a docum|
|00001910| 65 6e 74 20 61 73 73 6f | 63 69 61 74 65 64 20 77 |ent asso|ciated w|
|00001920| 69 74 68 20 61 0d 2f 2f | 20 77 69 6e 64 6f 77 2c |ith a.//| window,|
|00001930| 20 79 6f 75 20 63 6f 75 | 6c 64 20 64 6f 20 61 6e | you cou|ld do an|
|00001940| 79 20 64 6f 63 75 6d 65 | 6e 74 20 73 61 76 69 6e |y docume|nt savin|
|00001950| 67 20 70 72 6f 63 65 73 | 73 69 6e 67 20 69 66 20 |g proces|sing if |
|00001960| 69 74 20 69 73 20 27 64 | 69 72 74 79 27 2e 0d 2f |it is 'd|irty'../|
|00001970| 2f 20 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 20 |/ DoClos|eWindow |
|00001980| 77 6f 75 6c 64 20 72 65 | 74 75 72 6e 20 74 72 75 |would re|turn tru|
|00001990| 65 20 69 66 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |e if the| window |
|000019a0| 61 63 74 75 61 6c 6c 79 | 20 63 6c 6f 73 65 64 2c |actually| closed,|
|000019b0| 20 69 2e 65 2e 2c 0d 2f | 2f 20 74 68 65 20 75 73 | i.e.,./|/ the us|
|000019c0| 65 72 20 64 69 64 6e d5 | 74 20 63 61 6e 63 65 6c |er didn.|t cancel|
|000019d0| 20 66 72 6f 6d 20 61 20 | 73 61 76 65 20 64 69 61 | from a |save dia|
|000019e0| 6c 6f 67 2e 20 54 68 69 | 73 20 72 65 73 75 6c 74 |log. Thi|s result|
|000019f0| 20 69 73 20 68 61 6e 64 | 79 20 77 68 65 6e 0d 2f | is hand|y when./|
|00001a00| 2f 20 74 68 65 20 75 73 | 65 72 20 71 75 69 74 73 |/ the us|er quits|
|00001a10| 20 61 6e 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2c | an appl|ication,|
|00001a20| 20 62 75 74 20 74 68 65 | 6e 20 63 61 6e 63 65 6c | but the|n cancel|
|00001a30| 73 20 74 68 65 20 73 61 | 76 65 20 6f 66 20 61 20 |s the sa|ve of a |
|00001a40| 64 6f 63 75 6d 65 6e 74 | 0d 2f 2f 20 61 73 73 6f |document|.// asso|
|00001a50| 63 69 61 74 65 64 20 77 | 69 74 68 20 61 20 77 69 |ciated w|ith a wi|
|00001a60| 6e 64 6f 77 2e 0d 0d 54 | 45 44 6f 63 75 6d 65 6e |ndow...T|EDocumen|
|00001a70| 74 3a 3a 7e 54 45 44 6f | 63 75 6d 65 6e 74 28 29 |t::~TEDo|cument()|
|00001a80| 0d 7b 0d 09 48 69 64 65 | 57 69 6e 64 6f 77 28 66 |.{..Hide|Window(f|
|00001a90| 44 6f 63 57 69 6e 64 6f | 77 29 3b 0d 09 69 66 20 |DocWindo|w);..if |
|00001aa0| 28 20 66 44 6f 63 54 45 | 20 21 3d 20 6e 69 6c 20 |( fDocTE| != nil |
|00001ab0| 29 0d 09 20 20 7b 0d 09 | 09 54 45 44 69 73 70 6f |).. {..|.TEDispo|
|00001ac0| 73 65 28 66 44 6f 63 54 | 45 29 3b 09 09 09 2f 2f |se(fDocT|E);...//|
|00001ad0| 20 64 69 73 70 6f 73 65 | 20 74 68 65 20 54 45 48 | dispose| the TEH|
|00001ae0| 61 6e 64 6c 65 20 69 66 | 20 77 65 20 67 6f 74 20 |andle if| we got |
|00001af0| 66 61 72 20 65 6e 6f 75 | 67 68 20 74 6f 20 6d 61 |far enou|gh to ma|
|00001b00| 6b 65 20 6f 6e 65 20 0d | 09 20 20 7d 0d 09 69 66 |ke one .|. }..if|
|00001b10| 20 28 20 66 44 6f 63 56 | 53 63 72 6f 6c 6c 20 21 | ( fDocV|Scroll !|
|00001b20| 3d 20 6e 69 6c 20 29 0d | 09 20 20 7b 0d 09 09 44 |= nil ).|. {...D|
|00001b30| 69 73 70 6f 73 65 43 6f | 6e 74 72 6f 6c 28 66 44 |isposeCo|ntrol(fD|
|00001b40| 6f 63 56 53 63 72 6f 6c | 6c 29 3b 0d 09 20 20 7d |ocVScrol|l);.. }|
|00001b50| 0d 09 69 66 20 28 20 66 | 44 6f 63 48 53 63 72 6f |..if ( f|DocHScro|
|00001b60| 6c 6c 20 21 3d 20 6e 69 | 6c 20 29 0d 09 20 20 7b |ll != ni|l ).. {|
|00001b70| 0d 09 09 44 69 73 70 6f | 73 65 43 6f 6e 74 72 6f |...Dispo|seContro|
|00001b80| 6c 28 66 44 6f 63 48 53 | 63 72 6f 6c 6c 29 3b 0d |l(fDocHS|croll);.|
|00001b90| 09 20 20 7d 0d 09 2f 2f | 20 62 61 73 65 20 63 6c |. }..//| base cl|
|00001ba0| 61 73 73 20 64 65 73 74 | 72 75 63 74 6f 72 20 77 |ass dest|ructor w|
|00001bb0| 69 6c 6c 20 64 69 73 70 | 6f 73 65 20 6f 66 20 77 |ill disp|ose of w|
|00001bc0| 69 6e 64 6f 77 0d 7d 0d | 0d 76 6f 69 64 20 54 45 |indow.}.|.void TE|
|00001bd0| 44 6f 63 75 6d 65 6e 74 | 3a 3a 44 6f 5a 6f 6f 6d |Document|::DoZoom|
|00001be0| 28 73 68 6f 72 74 20 70 | 61 72 74 43 6f 64 65 29 |(short p|artCode)|
|00001bf0| 0d 7b 0d 09 52 65 63 74 | 20 74 52 65 63 74 3b 0d |.{..Rect| tRect;.|
|00001c00| 0d 09 74 52 65 63 74 20 | 3d 20 66 44 6f 63 57 69 |..tRect |= fDocWi|
|00001c10| 6e 64 6f 77 2d 3e 70 6f | 72 74 52 65 63 74 3b 0d |ndow->po|rtRect;.|
|00001c20| 09 45 72 61 73 65 52 65 | 63 74 28 26 74 52 65 63 |.EraseRe|ct(&tRec|
|00001c30| 74 29 3b 0d 09 5a 6f 6f | 6d 57 69 6e 64 6f 77 28 |t);..Zoo|mWindow(|
|00001c40| 66 44 6f 63 57 69 6e 64 | 6f 77 2c 20 70 61 72 74 |fDocWind|ow, part|
|00001c50| 43 6f 64 65 2c 20 66 44 | 6f 63 57 69 6e 64 6f 77 |Code, fD|ocWindow|
|00001c60| 20 3d 3d 20 46 72 6f 6e | 74 57 69 6e 64 6f 77 28 | == Fron|tWindow(|
|00001c70| 29 29 3b 0d 09 41 64 6a | 75 73 74 53 63 72 6f 6c |));..Adj|ustScrol|
|00001c80| 6c 62 61 72 73 28 74 72 | 75 65 29 3b 09 09 2f 2f |lbars(tr|ue);..//|
|00001c90| 20 61 64 6a 75 73 74 2c | 20 72 65 64 72 61 77 20 | adjust,| redraw |
|00001ca0| 61 6e 79 77 61 79 20 0d | 09 41 64 6a 75 73 74 54 |anyway .|.AdjustT|
|00001cb0| 45 28 29 3b 0d 09 49 6e | 76 61 6c 52 65 63 74 28 |E();..In|valRect(|
|00001cc0| 26 74 52 65 63 74 29 3b | 09 09 09 2f 2f 20 69 6e |&tRect);|...// in|
|00001cd0| 76 61 6c 69 64 61 74 65 | 20 74 68 65 20 77 68 6f |validate| the who|
|00001ce0| 6c 65 20 63 6f 6e 74 65 | 6e 74 20 0d 09 2f 2f 20 |le conte|nt ..// |
|00001cf0| 74 68 65 20 73 63 72 6f | 6c 6c 62 61 72 73 20 77 |the scro|llbars w|
|00001d00| 65 72 65 20 74 61 6b 65 | 6e 20 63 61 72 65 20 6f |ere take|n care o|
|00001d10| 66 20 62 79 20 41 64 6a | 75 73 74 53 63 72 6f 6c |f by Adj|ustScrol|
|00001d20| 6c 62 61 72 73 2c 20 73 | 6f 20 76 61 6c 69 64 61 |lbars, s|o valida|
|00001d30| 74 65 20 d5 65 6d 20 0d | 09 74 52 65 63 74 20 3d |te .em .|.tRect =|
|00001d40| 20 28 2a 66 44 6f 63 56 | 53 63 72 6f 6c 6c 29 2d | (*fDocV|Scroll)-|
|00001d50| 3e 63 6f 6e 74 72 6c 52 | 65 63 74 3b 0d 09 56 61 |>contrlR|ect;..Va|
|00001d60| 6c 69 64 52 65 63 74 28 | 26 74 52 65 63 74 29 3b |lidRect(|&tRect);|
|00001d70| 0d 09 74 52 65 63 74 20 | 3d 20 28 2a 66 44 6f 63 |..tRect |= (*fDoc|
|00001d80| 48 53 63 72 6f 6c 6c 29 | 2d 3e 63 6f 6e 74 72 6c |HScroll)|->contrl|
|00001d90| 52 65 63 74 3b 0d 09 56 | 61 6c 69 64 52 65 63 74 |Rect;..V|alidRect|
|00001da0| 28 26 74 52 65 63 74 29 | 3b 0d 7d 0d 0d 2f 2f 20 |(&tRect)|;.}..// |
|00001db0| 43 61 6c 6c 65 64 20 77 | 68 65 6e 20 61 20 6d 6f |Called w|hen a mo|
|00001dc0| 75 73 65 44 6f 77 6e 20 | 6f 63 63 75 72 73 20 69 |useDown |occurs i|
|00001dd0| 6e 20 74 68 65 20 67 72 | 6f 77 20 62 6f 78 20 6f |n the gr|ow box o|
|00001de0| 66 20 61 6e 20 61 63 74 | 69 76 65 20 77 69 6e 64 |f an act|ive wind|
|00001df0| 6f 77 2e 20 0d 0d 76 6f | 69 64 20 54 45 44 6f 63 |ow. ..vo|id TEDoc|
|00001e00| 75 6d 65 6e 74 3a 3a 44 | 6f 47 72 6f 77 28 45 76 |ument::D|oGrow(Ev|
|00001e10| 65 6e 74 52 65 63 6f 72 | 64 2a 20 74 68 65 45 76 |entRecor|d* theEv|
|00001e20| 65 6e 74 29 0d 7b 0d 09 | 6c 6f 6e 67 20 67 72 6f |ent).{..|long gro|
|00001e30| 77 52 65 73 75 6c 74 3b | 0d 09 52 65 63 74 20 74 |wResult;|..Rect t|
|00001e40| 52 65 63 74 2c 20 74 52 | 65 63 74 32 3b 0d 09 0d |Rect, tR|ect2;...|
|00001e50| 09 74 52 65 63 74 20 3d | 20 71 64 2e 73 63 72 65 |.tRect =| qd.scre|
|00001e60| 65 6e 42 69 74 73 2e 62 | 6f 75 6e 64 73 3b 0d 09 |enBits.b|ounds;..|
|00001e70| 74 52 65 63 74 2e 6c 65 | 66 74 20 3d 20 6b 4d 69 |tRect.le|ft = kMi|
|00001e80| 6e 44 6f 63 44 69 6d 3b | 0d 09 74 52 65 63 74 2e |nDocDim;|..tRect.|
|00001e90| 74 6f 70 20 3d 20 6b 4d | 69 6e 44 6f 63 44 69 6d |top = kM|inDocDim|
|00001ea0| 3b 0d 09 67 72 6f 77 52 | 65 73 75 6c 74 20 3d 20 |;..growR|esult = |
|00001eb0| 47 72 6f 77 57 69 6e 64 | 6f 77 28 66 44 6f 63 57 |GrowWind|ow(fDocW|
|00001ec0| 69 6e 64 6f 77 2c 20 74 | 68 65 45 76 65 6e 74 2d |indow, t|heEvent-|
|00001ed0| 3e 77 68 65 72 65 2c 20 | 26 74 52 65 63 74 29 3b |>where, |&tRect);|
|00001ee0| 0d 09 2f 2f 20 73 65 65 | 20 69 66 20 69 74 20 72 |..// see| if it r|
|00001ef0| 65 61 6c 6c 79 20 63 68 | 61 6e 67 65 64 20 73 69 |eally ch|anged si|
|00001f00| 7a 65 20 0d 09 69 66 20 | 28 20 67 72 6f 77 52 65 |ze ..if |( growRe|
|00001f10| 73 75 6c 74 20 21 3d 20 | 30 20 29 0d 09 20 20 7b |sult != |0 ).. {|
|00001f20| 0d 09 09 74 52 65 63 74 | 20 3d 20 28 2a 66 44 6f |...tRect| = (*fDo|
|00001f30| 63 54 45 29 2d 3e 76 69 | 65 77 52 65 63 74 3b 0d |cTE)->vi|ewRect;.|
|00001f40| 09 09 53 69 7a 65 57 69 | 6e 64 6f 77 28 66 44 6f |..SizeWi|ndow(fDo|
|00001f50| 63 57 69 6e 64 6f 77 2c | 20 4c 6f 57 72 64 28 67 |cWindow,| LoWrd(g|
|00001f60| 72 6f 77 52 65 73 75 6c | 74 29 2c 20 48 69 57 72 |rowResul|t), HiWr|
|00001f70| 64 28 67 72 6f 77 52 65 | 73 75 6c 74 29 2c 20 74 |d(growRe|sult), t|
|00001f80| 72 75 65 29 3b 0d 09 09 | 41 64 6a 75 73 74 53 63 |rue);...|AdjustSc|
|00001f90| 72 6f 6c 6c 62 61 72 73 | 28 74 72 75 65 29 3b 0d |rollbars|(true);.|
|00001fa0| 09 09 41 64 6a 75 73 74 | 54 45 28 29 3b 0d 09 09 |..Adjust|TE();...|
|00001fb0| 2f 2f 20 63 61 6c 63 75 | 6c 61 74 65 20 26 20 76 |// calcu|late & v|
|00001fc0| 61 6c 69 64 61 74 65 20 | 74 68 65 20 72 65 67 69 |alidate |the regi|
|00001fd0| 6f 6e 20 74 68 61 74 20 | 68 61 73 6e d5 74 20 63 |on that |hasn.t c|
|00001fe0| 68 61 6e 67 65 64 20 73 | 6f 20 69 74 20 77 6f 6e |hanged s|o it won|
|00001ff0| d5 74 20 67 65 74 20 72 | 65 64 72 61 77 6e 0d 09 |.t get r|edrawn..|
|00002000| 09 2f 2f 20 4e 6f 74 65 | 3a 20 77 65 20 63 6f 70 |.// Note|: we cop|
|00002010| 79 20 72 65 63 74 61 6e | 67 6c 65 73 20 73 6f 20 |y rectan|gles so |
|00002020| 74 68 61 74 20 77 65 20 | 64 6f 6e 27 74 20 74 61 |that we |don't ta|
|00002030| 6b 65 20 61 64 64 72 65 | 73 73 20 6f 66 20 6f 62 |ke addre|ss of ob|
|00002040| 6a 65 63 74 20 66 69 65 | 6c 64 73 2e 0d 09 09 74 |ject fie|lds....t|
|00002050| 52 65 63 74 32 20 3d 20 | 28 2a 66 44 6f 63 54 45 |Rect2 = |(*fDocTE|
|00002060| 29 2d 3e 76 69 65 77 52 | 65 63 74 3b 0d 09 09 28 |)->viewR|ect;...(|
|00002070| 76 6f 69 64 29 20 53 65 | 63 74 52 65 63 74 28 26 |void) Se|ctRect(&|
|00002080| 74 52 65 63 74 2c 20 26 | 74 52 65 63 74 32 2c 20 |tRect, &|tRect2, |
|00002090| 26 74 52 65 63 74 29 3b | 0d 09 09 74 52 65 63 74 |&tRect);|...tRect|
|000020a0| 32 20 3d 20 66 44 6f 63 | 57 69 6e 64 6f 77 2d 3e |2 = fDoc|Window->|
|000020b0| 70 6f 72 74 52 65 63 74 | 3b 20 49 6e 76 61 6c 52 |portRect|; InvalR|
|000020c0| 65 63 74 28 26 74 52 65 | 63 74 32 29 3b 0d 09 09 |ect(&tRe|ct2);...|
|000020d0| 56 61 6c 69 64 52 65 63 | 74 28 26 74 52 65 63 74 |ValidRec|t(&tRect|
|000020e0| 29 3b 0d 09 09 74 52 65 | 63 74 32 20 3d 20 28 2a |);...tRe|ct2 = (*|
|000020f0| 66 44 6f 63 56 53 63 72 | 6f 6c 6c 29 2d 3e 63 6f |fDocVScr|oll)->co|
|00002100| 6e 74 72 6c 52 65 63 74 | 3b 20 56 61 6c 69 64 52 |ntrlRect|; ValidR|
|00002110| 65 63 74 28 26 74 52 65 | 63 74 32 29 3b 0d 09 09 |ect(&tRe|ct2);...|
|00002120| 74 52 65 63 74 32 20 3d | 20 28 2a 66 44 6f 63 48 |tRect2 =| (*fDocH|
|00002130| 53 63 72 6f 6c 6c 29 2d | 3e 63 6f 6e 74 72 6c 52 |Scroll)-|>contrlR|
|00002140| 65 63 74 3b 20 56 61 6c | 69 64 52 65 63 74 28 26 |ect; Val|idRect(&|
|00002150| 74 52 65 63 74 32 29 3b | 0d 09 20 20 7d 0d 7d 0d |tRect2);|.. }.}.|
|00002160| 0d 76 6f 69 64 20 54 45 | 44 6f 63 75 6d 65 6e 74 |.void TE|Document|
|00002170| 3a 3a 44 6f 43 6f 6e 74 | 65 6e 74 28 45 76 65 6e |::DoCont|ent(Even|
|00002180| 74 52 65 63 6f 72 64 2a | 20 74 68 65 45 76 65 6e |tRecord*| theEven|
|00002190| 74 29 0d 7b 0d 09 50 6f | 69 6e 74 20 6d 6f 75 73 |t).{..Po|int mous|
|000021a0| 65 3b 0d 09 43 6f 6e 74 | 72 6f 6c 48 61 6e 64 6c |e;..Cont|rolHandl|
|000021b0| 65 20 63 6f 6e 74 72 6f | 6c 3b 0d 09 73 68 6f 72 |e contro|l;..shor|
|000021c0| 74 20 70 61 72 74 2c 20 | 76 61 6c 75 65 3b 0d 09 |t part, |value;..|
|000021d0| 42 6f 6f 6c 65 61 6e 20 | 73 68 69 66 74 44 6f 77 |Boolean |shiftDow|
|000021e0| 6e 3b 0d 09 52 65 63 74 | 20 74 65 52 65 63 74 3b |n;..Rect| teRect;|
|000021f0| 0d 0d 09 53 65 74 50 6f | 72 74 28 66 44 6f 63 57 |...SetPo|rt(fDocW|
|00002200| 69 6e 64 6f 77 29 3b 0d | 09 6d 6f 75 73 65 20 3d |indow);.|.mouse =|
|00002210| 20 74 68 65 45 76 65 6e | 74 2d 3e 77 68 65 72 65 | theEven|t->where|
|00002220| 3b 09 09 09 09 09 09 09 | 2f 2f 20 67 65 74 20 74 |;.......|// get t|
|00002230| 68 65 20 63 6c 69 63 6b | 20 70 6f 73 69 74 69 6f |he click| positio|
|00002240| 6e 20 0d 09 47 6c 6f 62 | 61 6c 54 6f 4c 6f 63 61 |n ..Glob|alToLoca|
|00002250| 6c 28 26 6d 6f 75 73 65 | 29 3b 0d 09 47 65 74 54 |l(&mouse|);..GetT|
|00002260| 45 52 65 63 74 28 26 74 | 65 52 65 63 74 29 3b 0d |ERect(&t|eRect);.|
|00002270| 09 69 66 20 28 20 50 74 | 49 6e 52 65 63 74 28 6d |.if ( Pt|InRect(m|
|00002280| 6f 75 73 65 2c 20 26 74 | 65 52 65 63 74 29 20 29 |ouse, &t|eRect) )|
|00002290| 0d 09 20 20 7b 0d 09 09 | 2f 2f 20 73 65 65 20 69 |.. {...|// see i|
|000022a0| 66 20 77 65 20 6e 65 65 | 64 20 74 6f 20 65 78 74 |f we nee|d to ext|
|000022b0| 65 6e 64 20 74 68 65 20 | 73 65 6c 65 63 74 69 6f |end the |selectio|
|000022c0| 6e 0d 09 09 73 68 69 66 | 74 44 6f 77 6e 20 3d 20 |n...shif|tDown = |
|000022d0| 28 74 68 65 45 76 65 6e | 74 2d 3e 6d 6f 64 69 66 |(theEven|t->modif|
|000022e0| 69 65 72 73 20 26 20 73 | 68 69 66 74 4b 65 79 29 |iers & s|hiftKey)|
|000022f0| 20 21 3d 20 30 3b 09 2f | 2f 20 65 78 74 65 6e 64 | != 0;./|/ extend|
|00002300| 20 69 66 20 53 68 69 66 | 74 20 69 73 20 64 6f 77 | if Shif|t is dow|
|00002310| 6e 0d 09 09 54 45 43 6c | 69 63 6b 28 6d 6f 75 73 |n...TECl|ick(mous|
|00002320| 65 2c 20 73 68 69 66 74 | 44 6f 77 6e 2c 20 66 44 |e, shift|Down, fD|
|00002330| 6f 63 54 45 29 3b 0d 09 | 20 20 7d 0d 09 65 6c 73 |ocTE);..| }..els|
|00002340| 65 0d 09 20 20 7b 0d 09 | 09 70 61 72 74 20 3d 20 |e.. {..|.part = |
|00002350| 46 69 6e 64 43 6f 6e 74 | 72 6f 6c 28 6d 6f 75 73 |FindCont|rol(mous|
|00002360| 65 2c 20 66 44 6f 63 57 | 69 6e 64 6f 77 2c 20 26 |e, fDocW|indow, &|
|00002370| 63 6f 6e 74 72 6f 6c 29 | 3b 0d 09 09 73 77 69 74 |control)|;...swit|
|00002380| 63 68 20 28 20 70 61 72 | 74 20 29 0d 09 09 20 20 |ch ( par|t )... |
|00002390| 7b 0d 09 09 09 63 61 73 | 65 20 30 3a 0d 09 09 09 |{....cas|e 0:....|
|000023a0| 09 2f 2f 20 64 6f 20 6e | 6f 74 68 69 6e 67 20 69 |.// do n|othing i|
|000023b0| 66 20 6e 6f 74 20 69 6e | 20 61 20 63 6f 6e 74 72 |f not in| a contr|
|000023c0| 6f 6c 0d 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |ol.....b|reak;...|
|000023d0| 09 63 61 73 65 20 69 6e | 54 68 75 6d 62 3a 0d 09 |.case in|Thumb:..|
|000023e0| 09 09 09 76 61 6c 75 65 | 20 3d 20 47 65 74 43 74 |...value| = GetCt|
|000023f0| 6c 56 61 6c 75 65 28 63 | 6f 6e 74 72 6f 6c 29 3b |lValue(c|ontrol);|
|00002400| 0d 09 09 09 09 70 61 72 | 74 20 3d 20 54 72 61 63 |.....par|t = Trac|
|00002410| 6b 43 6f 6e 74 72 6f 6c | 28 63 6f 6e 74 72 6f 6c |kControl|(control|
|00002420| 2c 20 6d 6f 75 73 65 2c | 20 6e 69 6c 29 3b 0d 09 |, mouse,| nil);..|
|00002430| 09 09 09 69 66 20 28 20 | 70 61 72 74 20 21 3d 20 |...if ( |part != |
|00002440| 30 20 29 0d 09 09 09 09 | 20 20 7b 0d 09 09 09 09 |0 ).....| {.....|
|00002450| 09 76 61 6c 75 65 20 2d | 3d 20 47 65 74 43 74 6c |.value -|= GetCtl|
|00002460| 56 61 6c 75 65 28 63 6f | 6e 74 72 6f 6c 29 3b 0d |Value(co|ntrol);.|
|00002470| 09 09 09 09 09 2f 2f 20 | 76 61 6c 75 65 20 6e 6f |.....// |value no|
|00002480| 77 20 68 61 73 20 43 48 | 41 4e 47 45 20 69 6e 20 |w has CH|ANGE in |
|00002490| 76 61 6c 75 65 3b 20 69 | 66 20 76 61 6c 75 65 20 |value; i|f value |
|000024a0| 63 68 61 6e 67 65 64 2c | 20 73 63 72 6f 6c 6c 20 |changed,| scroll |
|000024b0| 0d 09 09 09 09 09 69 66 | 20 28 20 76 61 6c 75 65 |......if| ( value|
|000024c0| 20 21 3d 20 30 20 29 0d | 09 09 09 09 09 09 69 66 | != 0 ).|......if|
|000024d0| 20 28 20 63 6f 6e 74 72 | 6f 6c 20 3d 3d 20 66 44 | ( contr|ol == fD|
|000024e0| 6f 63 56 53 63 72 6f 6c | 6c 20 29 0d 09 09 09 09 |ocVScrol|l ).....|
|000024f0| 09 09 09 54 45 53 63 72 | 6f 6c 6c 28 30 2c 20 76 |...TEScr|oll(0, v|
|00002500| 61 6c 75 65 20 2a 20 28 | 2a 66 44 6f 63 54 45 29 |alue * (|*fDocTE)|
|00002510| 2d 3e 6c 69 6e 65 48 65 | 69 67 68 74 2c 20 66 44 |->lineHe|ight, fD|
|00002520| 6f 63 54 45 29 3b 0d 09 | 09 09 09 09 09 65 6c 73 |ocTE);..|.....els|
|00002530| 65 20 54 45 53 63 72 6f | 6c 6c 28 76 61 6c 75 65 |e TEScro|ll(value|
|00002540| 2c 20 30 2c 20 66 44 6f | 63 54 45 29 3b 0d 09 09 |, 0, fDo|cTE);...|
|00002550| 09 09 20 20 7d 0d 09 09 | 09 09 62 72 65 61 6b 3b |.. }...|..break;|
|00002560| 0d 09 09 09 64 65 66 61 | 75 6c 74 3a 09 09 09 09 |....defa|ult:....|
|00002570| 09 09 2f 2f 20 74 68 65 | 79 20 63 6c 69 63 6b 65 |..// the|y clicke|
|00002580| 64 20 69 6e 20 61 6e 20 | 61 72 72 6f 77 2c 20 73 |d in an |arrow, s|
|00002590| 6f 20 74 72 61 63 6b 20 | 26 20 73 63 72 6f 6c 6c |o track |& scroll|
|000025a0| 20 0d 09 09 09 09 69 66 | 20 28 20 63 6f 6e 74 72 | .....if| ( contr|
|000025b0| 6f 6c 20 3d 3d 20 66 44 | 6f 63 56 53 63 72 6f 6c |ol == fD|ocVScrol|
|000025c0| 6c 20 29 0d 09 09 09 09 | 09 76 61 6c 75 65 20 3d |l ).....|.value =|
|000025d0| 20 54 72 61 63 6b 43 6f | 6e 74 72 6f 6c 28 63 6f | TrackCo|ntrol(co|
|000025e0| 6e 74 72 6f 6c 2c 20 6d | 6f 75 73 65 2c 20 28 50 |ntrol, m|ouse, (P|
|000025f0| 72 6f 63 50 74 72 29 20 | 56 41 63 74 69 6f 6e 50 |rocPtr) |VActionP|
|00002600| 72 6f 63 29 3b 0d 09 09 | 09 09 65 6c 73 65 20 76 |roc);...|..else v|
|00002610| 61 6c 75 65 20 3d 20 54 | 72 61 63 6b 43 6f 6e 74 |alue = T|rackCont|
|00002620| 72 6f 6c 28 63 6f 6e 74 | 72 6f 6c 2c 20 6d 6f 75 |rol(cont|rol, mou|
|00002630| 73 65 2c 20 28 50 72 6f | 63 50 74 72 29 20 48 41 |se, (Pro|cPtr) HA|
|00002640| 63 74 69 6f 6e 50 72 6f | 63 29 3b 0d 09 09 09 09 |ctionPro|c);.....|
|00002650| 62 72 65 61 6b 3b 0d 09 | 09 20 20 7d 0d 09 20 20 |break;..|. }.. |
|00002660| 7d 0d 7d 0d 0d 76 6f 69 | 64 20 54 45 44 6f 63 75 |}.}..voi|d TEDocu|
|00002670| 6d 65 6e 74 3a 3a 44 6f | 4b 65 79 44 6f 77 6e 28 |ment::Do|KeyDown(|
|00002680| 45 76 65 6e 74 52 65 63 | 6f 72 64 2a 20 74 68 65 |EventRec|ord* the|
|00002690| 45 76 65 6e 74 29 0d 7b | 0d 09 63 68 61 72 20 6b |Event).{|..char k|
|000026a0| 65 79 3b 0d 0d 09 69 66 | 20 28 74 68 65 45 76 65 |ey;...if| (theEve|
|000026b0| 6e 74 2d 3e 6d 6f 64 69 | 66 69 65 72 73 20 26 20 |nt->modi|fiers & |
|000026c0| 63 6d 64 4b 65 79 29 09 | 2f 2f 20 64 6f 6e 27 74 |cmdKey).|// don't|
|000026d0| 20 70 72 6f 63 65 73 73 | 20 63 6f 6d 6d 61 6e 64 | process| command|
|000026e0| 20 63 68 61 72 61 63 74 | 65 72 73 0d 09 20 20 72 | charact|ers.. r|
|000026f0| 65 74 75 72 6e 3b 0d 09 | 6b 65 79 20 3d 20 28 63 |eturn;..|key = (c|
|00002700| 68 61 72 29 20 28 74 68 | 65 45 76 65 6e 74 2d 3e |har) (th|eEvent->|
|00002710| 6d 65 73 73 61 67 65 20 | 26 20 63 68 61 72 43 6f |message |& charCo|
|00002720| 64 65 4d 61 73 6b 29 3b | 0d 09 2f 2f 20 77 65 20 |deMask);|..// we |
|00002730| 68 61 76 65 20 61 20 63 | 68 61 72 2e 20 66 6f 72 |have a c|har. for|
|00002740| 20 6f 75 72 20 77 69 6e | 64 6f 77 3b 20 73 65 65 | our win|dow; see|
|00002750| 20 69 66 20 77 65 20 61 | 72 65 20 73 74 69 6c 6c | if we a|re still|
|00002760| 20 62 65 6c 6f 77 20 54 | 65 78 74 45 64 69 74 d5 | below T|extEdit.|
|00002770| 73 0d 09 2f 2f 20 6c 69 | 6d 69 74 20 66 6f 72 20 |s..// li|mit for |
|00002780| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 63 68 |the numb|er of ch|
|00002790| 61 72 61 63 74 65 72 73 | 0d 09 69 66 20 28 28 6b |aracters|..if ((k|
|000027a0| 65 79 20 3d 3d 20 6b 44 | 65 6c 43 68 61 72 29 20 |ey == kD|elChar) |
|000027b0| 7c 7c 0d 09 09 28 28 2a | 66 44 6f 63 54 45 29 2d |||...((*|fDocTE)-|
|000027c0| 3e 74 65 4c 65 6e 67 74 | 68 20 2d 20 28 28 2a 66 |>teLengt|h - ((*f|
|000027d0| 44 6f 63 54 45 29 2d 3e | 73 65 6c 45 6e 64 20 2d |DocTE)->|selEnd -|
|000027e0| 20 28 2a 66 44 6f 63 54 | 45 29 2d 3e 73 65 6c 53 | (*fDocT|E)->selS|
|000027f0| 74 61 72 74 29 20 2b 20 | 31 20 3c 20 6b 4d 61 78 |tart) + |1 < kMax|
|00002800| 54 45 4c 65 6e 67 74 68 | 29 20 29 0d 09 20 20 7b |TELength|) ).. {|
|00002810| 0d 09 09 54 45 4b 65 79 | 28 6b 65 79 2c 20 66 44 |...TEKey|(key, fD|
|00002820| 6f 63 54 45 29 3b 0d 09 | 09 41 64 6a 75 73 74 53 |ocTE);..|.AdjustS|
|00002830| 63 72 6f 6c 6c 62 61 72 | 73 28 66 61 6c 73 65 29 |crollbar|s(false)|
|00002840| 3b 0d 09 09 41 64 6a 75 | 73 74 54 45 28 29 3b 0d |;...Adju|stTE();.|
|00002850| 09 20 20 7d 0d 09 65 6c | 73 65 20 41 6c 65 72 74 |. }..el|se Alert|
|00002860| 55 73 65 72 28 6b 54 45 | 44 6f 63 45 72 72 53 74 |User(kTE|DocErrSt|
|00002870| 72 69 6e 67 73 2c 65 45 | 78 63 65 65 64 43 68 61 |rings,eE|xceedCha|
|00002880| 72 29 3b 0d 7d 0d 0d 76 | 6f 69 64 20 54 45 44 6f |r);.}..v|oid TEDo|
|00002890| 63 75 6d 65 6e 74 3a 3a | 44 6f 41 63 74 69 76 61 |cument::|DoActiva|
|000028a0| 74 65 28 42 6f 6f 6c 65 | 61 6e 20 62 65 63 6f 6d |te(Boole|an becom|
|000028b0| 69 6e 67 41 63 74 69 76 | 65 29 0d 7b 0d 09 69 66 |ingActiv|e).{..if|
|000028c0| 20 28 20 62 65 63 6f 6d | 69 6e 67 41 63 74 69 76 | ( becom|ingActiv|
|000028d0| 65 20 29 0d 09 20 20 7b | 0d 09 09 52 67 6e 48 61 |e ).. {|...RgnHa|
|000028e0| 6e 64 6c 65 09 74 65 6d | 70 52 67 6e 3b 0d 09 09 |ndle.tem|pRgn;...|
|000028f0| 52 67 6e 48 61 6e 64 6c | 65 09 63 6c 69 70 52 67 |RgnHandl|e.clipRg|
|00002900| 6e 3b 0d 09 09 52 65 63 | 74 09 09 67 72 6f 77 52 |n;...Rec|t..growR|
|00002910| 65 63 74 3b 0d 09 09 52 | 65 63 74 09 09 74 52 65 |ect;...R|ect..tRe|
|00002920| 63 74 3b 0d 0d 09 09 2f | 2f 20 73 69 6e 63 65 20 |ct;..../|/ since |
|00002930| 77 65 20 64 6f 6e d5 74 | 20 77 61 6e 74 20 54 45 |we don.t| want TE|
|00002940| 41 63 74 69 76 61 74 65 | 20 74 6f 20 64 72 61 77 |Activate| to draw|
|00002950| 20 61 20 73 65 6c 65 63 | 74 69 6f 6e 20 69 6e 20 | a selec|tion in |
|00002960| 61 6e 20 61 72 65 61 20 | 77 68 65 72 65 0d 09 09 |an area |where...|
|00002970| 2f 2f 20 77 65 d5 72 65 | 20 67 6f 69 6e 67 20 74 |// we.re| going t|
|00002980| 6f 20 65 72 61 73 65 20 | 61 6e 64 20 72 65 64 72 |o erase |and redr|
|00002990| 61 77 2c 20 77 65 d5 6c | 6c 20 63 6c 69 70 20 6f |aw, we.l|l clip o|
|000029a0| 75 74 20 74 68 65 20 75 | 70 64 61 74 65 20 72 65 |ut the u|pdate re|
|000029b0| 67 69 6f 6e 0d 09 09 2f | 2f 20 62 65 66 6f 72 65 |gion.../|/ before|
|000029c0| 20 63 61 6c 6c 69 6e 67 | 20 69 74 2e 0d 09 09 74 | calling| it....t|
|000029d0| 65 6d 70 52 67 6e 20 3d | 20 4e 65 77 52 67 6e 28 |empRgn =| NewRgn(|
|000029e0| 29 3b 0d 09 09 63 6c 69 | 70 52 67 6e 20 3d 20 4e |);...cli|pRgn = N|
|000029f0| 65 77 52 67 6e 28 29 3b | 0d 09 09 2f 2f 20 73 61 |ewRgn();|...// sa|
|00002a00| 76 65 20 6f 6c 64 20 75 | 70 64 61 74 65 20 72 65 |ve old u|pdate re|
|00002a10| 67 69 6f 6e 0d 09 09 43 | 6f 70 79 52 67 6e 28 28 |gion...C|opyRgn((|
|00002a20| 28 57 69 6e 64 6f 77 50 | 65 65 6b 29 20 66 44 6f |(WindowP|eek) fDo|
|00002a30| 63 57 69 6e 64 6f 77 29 | 2d 3e 75 70 64 61 74 65 |cWindow)|->update|
|00002a40| 52 67 6e 2c 20 74 65 6d | 70 52 67 6e 29 3b 0d 09 |Rgn, tem|pRgn);..|
|00002a50| 09 2f 2f 20 70 75 74 20 | 69 74 20 69 6e 20 6c 6f |.// put |it in lo|
|00002a60| 63 61 6c 20 63 6f 6f 72 | 64 73 0d 09 09 4f 66 66 |cal coor|ds...Off|
|00002a70| 73 65 74 52 67 6e 28 74 | 65 6d 70 52 67 6e 2c 20 |setRgn(t|empRgn, |
|00002a80| 66 44 6f 63 57 69 6e 64 | 6f 77 2d 3e 70 6f 72 74 |fDocWind|ow->port|
|00002a90| 42 69 74 73 2e 62 6f 75 | 6e 64 73 2e 6c 65 66 74 |Bits.bou|nds.left|
|00002aa0| 2c 20 66 44 6f 63 57 69 | 6e 64 6f 77 2d 3e 70 6f |, fDocWi|ndow->po|
|00002ab0| 72 74 42 69 74 73 2e 62 | 6f 75 6e 64 73 2e 74 6f |rtBits.b|ounds.to|
|00002ac0| 70 29 3b 0d 09 09 47 65 | 74 43 6c 69 70 28 63 6c |p);...Ge|tClip(cl|
|00002ad0| 69 70 52 67 6e 29 3b 0d | 09 09 2f 2f 20 73 75 62 |ipRgn);.|..// sub|
|00002ae0| 74 72 61 63 74 20 75 70 | 64 61 74 65 52 67 6e 20 |tract up|dateRgn |
|00002af0| 66 72 6f 6d 20 63 6c 69 | 70 52 67 6e 0d 09 09 44 |from cli|pRgn...D|
|00002b00| 69 66 66 52 67 6e 28 63 | 6c 69 70 52 67 6e 2c 20 |iffRgn(c|lipRgn, |
|00002b10| 74 65 6d 70 52 67 6e 2c | 20 74 65 6d 70 52 67 6e |tempRgn,| tempRgn|
|00002b20| 29 3b 0d 09 09 2f 2f 20 | 6d 61 6b 65 20 69 74 20 |);...// |make it |
|00002b30| 74 68 65 20 6e 65 77 20 | 63 6c 69 70 52 67 6e 0d |the new |clipRgn.|
|00002b40| 09 09 53 65 74 43 6c 69 | 70 28 74 65 6d 70 52 67 |..SetCli|p(tempRg|
|00002b50| 6e 29 3b 0d 09 09 54 45 | 41 63 74 69 76 61 74 65 |n);...TE|Activate|
|00002b60| 28 66 44 6f 63 54 45 29 | 3b 0d 09 09 2f 2f 20 72 |(fDocTE)|;...// r|
|00002b70| 65 73 74 6f 72 65 20 74 | 68 65 20 66 75 6c 6c 2d |estore t|he full-|
|00002b80| 62 6c 6f 77 6e 20 63 6c | 69 70 52 67 6e 0d 09 09 |blown cl|ipRgn...|
|00002b90| 53 65 74 43 6c 69 70 28 | 63 6c 69 70 52 67 6e 29 |SetClip(|clipRgn)|
|00002ba0| 3b 0d 09 09 2f 2f 20 67 | 65 74 20 72 69 64 20 6f |;...// g|et rid o|
|00002bb0| 66 20 74 65 6d 70 20 72 | 65 67 69 6f 6e 73 0d 09 |f temp r|egions..|
|00002bc0| 09 44 69 73 70 6f 73 65 | 52 67 6e 28 74 65 6d 70 |.Dispose|Rgn(temp|
|00002bd0| 52 67 6e 29 3b 0d 09 09 | 44 69 73 70 6f 73 65 52 |Rgn);...|DisposeR|
|00002be0| 67 6e 28 63 6c 69 70 52 | 67 6e 29 3b 0d 0d 09 09 |gn(clipR|gn);....|
|00002bf0| 2f 2f 20 74 68 65 20 63 | 6f 6e 74 72 6f 6c 73 20 |// the c|ontrols |
|00002c00| 6d 75 73 74 20 62 65 20 | 72 65 64 72 61 77 6e 20 |must be |redrawn |
|00002c10| 6f 6e 20 61 63 74 69 76 | 61 74 69 6f 6e 3a 0d 09 |on activ|ation:..|
|00002c20| 09 28 2a 66 44 6f 63 56 | 53 63 72 6f 6c 6c 29 2d |.(*fDocV|Scroll)-|
|00002c30| 3e 63 6f 6e 74 72 6c 56 | 69 73 20 3d 20 6b 43 6f |>contrlV|is = kCo|
|00002c40| 6e 74 72 6f 6c 56 69 73 | 69 62 6c 65 3b 0d 09 09 |ntrolVis|ible;...|
|00002c50| 28 2a 66 44 6f 63 48 53 | 63 72 6f 6c 6c 29 2d 3e |(*fDocHS|croll)->|
|00002c60| 63 6f 6e 74 72 6c 56 69 | 73 20 3d 20 6b 43 6f 6e |contrlVi|s = kCon|
|00002c70| 74 72 6f 6c 56 69 73 69 | 62 6c 65 3b 0d 09 09 2f |trolVisi|ble;.../|
|00002c80| 2f 20 63 6f 70 79 20 72 | 65 63 74 61 6e 67 6c 65 |/ copy r|ectangle|
|00002c90| 73 20 74 6f 20 61 76 6f | 69 64 20 75 6e 73 61 66 |s to avo|id unsaf|
|00002ca0| 65 20 6f 62 6a 65 63 74 | 20 66 69 65 6c 64 20 72 |e object| field r|
|00002cb0| 65 66 65 72 65 6e 63 65 | 73 21 0d 09 09 74 52 65 |eference|s!...tRe|
|00002cc0| 63 74 20 3d 20 28 2a 66 | 44 6f 63 56 53 63 72 6f |ct = (*f|DocVScro|
|00002cd0| 6c 6c 29 2d 3e 63 6f 6e | 74 72 6c 52 65 63 74 3b |ll)->con|trlRect;|
|00002ce0| 20 49 6e 76 61 6c 52 65 | 63 74 28 26 74 52 65 63 | InvalRe|ct(&tRec|
|00002cf0| 74 29 3b 0d 09 09 74 52 | 65 63 74 20 3d 20 28 2a |t);...tR|ect = (*|
|00002d00| 66 44 6f 63 48 53 63 72 | 6f 6c 6c 29 2d 3e 63 6f |fDocHScr|oll)->co|
|00002d10| 6e 74 72 6c 52 65 63 74 | 3b 20 49 6e 76 61 6c 52 |ntrlRect|; InvalR|
|00002d20| 65 63 74 28 26 74 52 65 | 63 74 29 3b 0d 09 09 2f |ect(&tRe|ct);.../|
|00002d30| 2f 20 74 68 65 20 67 72 | 6f 77 62 6f 78 20 6e 65 |/ the gr|owbox ne|
|00002d40| 65 64 73 20 74 6f 20 62 | 65 20 72 65 64 72 61 77 |eds to b|e redraw|
|00002d50| 6e 20 6f 6e 20 61 63 74 | 69 76 61 74 69 6f 6e 3a |n on act|ivation:|
|00002d60| 0d 09 09 67 72 6f 77 52 | 65 63 74 20 3d 20 66 44 |...growR|ect = fD|
|00002d70| 6f 63 57 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |ocWindow|->portRe|
|00002d80| 63 74 3b 0d 09 09 2f 2f | 20 61 64 6a 75 73 74 20 |ct;...//| adjust |
|00002d90| 66 6f 72 20 74 68 65 20 | 73 63 72 6f 6c 6c 62 61 |for the |scrollba|
|00002da0| 72 73 0d 09 09 67 72 6f | 77 52 65 63 74 2e 74 6f |rs...gro|wRect.to|
|00002db0| 70 20 3d 20 67 72 6f 77 | 52 65 63 74 2e 62 6f 74 |p = grow|Rect.bot|
|00002dc0| 74 6f 6d 20 2d 20 6b 53 | 63 72 6f 6c 6c 62 61 72 |tom - kS|crollbar|
|00002dd0| 41 64 6a 75 73 74 3b 0d | 09 09 67 72 6f 77 52 65 |Adjust;.|..growRe|
|00002de0| 63 74 2e 6c 65 66 74 20 | 3d 20 67 72 6f 77 52 65 |ct.left |= growRe|
|00002df0| 63 74 2e 72 69 67 68 74 | 20 2d 20 6b 53 63 72 6f |ct.right| - kScro|
|00002e00| 6c 6c 62 61 72 41 64 6a | 75 73 74 3b 0d 09 09 49 |llbarAdj|ust;...I|
|00002e10| 6e 76 61 6c 52 65 63 74 | 28 26 67 72 6f 77 52 65 |nvalRect|(&growRe|
|00002e20| 63 74 29 3b 0d 09 20 20 | 7d 0d 09 65 6c 73 65 0d |ct);.. |}..else.|
|00002e30| 09 20 20 7b 09 09 0d 09 | 09 54 45 44 65 61 63 74 |. {....|.TEDeact|
|00002e40| 69 76 61 74 65 28 66 44 | 6f 63 54 45 29 3b 0d 09 |ivate(fD|ocTE);..|
|00002e50| 09 2f 2f 20 74 68 65 20 | 63 6f 6e 74 72 6f 6c 73 |.// the |controls|
|00002e60| 20 6d 75 73 74 20 62 65 | 20 68 69 64 64 65 6e 20 | must be| hidden |
|00002e70| 6f 6e 20 64 65 61 63 74 | 69 76 61 74 69 6f 6e 3a |on deact|ivation:|
|00002e80| 0d 09 09 48 69 64 65 43 | 6f 6e 74 72 6f 6c 28 66 |...HideC|ontrol(f|
|00002e90| 44 6f 63 56 53 63 72 6f | 6c 6c 29 3b 0d 09 09 48 |DocVScro|ll);...H|
|00002ea0| 69 64 65 43 6f 6e 74 72 | 6f 6c 28 66 44 6f 63 48 |ideContr|ol(fDocH|
|00002eb0| 53 63 72 6f 6c 6c 29 3b | 0d 09 09 2f 2f 20 77 65 |Scroll);|...// we|
|00002ec0| 20 64 72 61 77 20 67 72 | 6f 77 20 69 63 6f 6e 20 | draw gr|ow icon |
|00002ed0| 69 6d 6d 65 64 69 61 74 | 65 6c 79 2c 20 73 69 6e |immediat|ely, sin|
|00002ee0| 63 65 20 77 65 20 64 65 | 61 63 74 69 76 61 74 65 |ce we de|activate|
|00002ef0| 20 63 6f 6e 74 72 6f 6c | 73 0d 09 09 2f 2f 20 69 | control|s...// i|
|00002f00| 6d 6d 65 64 69 61 74 65 | 6c 79 2c 20 61 6e 64 20 |mmediate|ly, and |
|00002f10| 74 68 65 20 75 70 64 61 | 74 65 20 64 65 6c 61 79 |the upda|te delay|
|00002f20| 20 6c 6f 6f 6b 73 20 66 | 75 6e 6e 79 0d 09 09 44 | looks f|unny...D|
|00002f30| 72 61 77 47 72 6f 77 49 | 63 6f 6e 28 66 44 6f 63 |rawGrowI|con(fDoc|
|00002f40| 57 69 6e 64 6f 77 29 3b | 0d 09 20 20 7d 0d 7d 0d |Window);|.. }.}.|
|00002f50| 0d 76 6f 69 64 20 54 45 | 44 6f 63 75 6d 65 6e 74 |.void TE|Document|
|00002f60| 3a 3a 44 6f 55 70 64 61 | 74 65 28 29 0d 7b 0d 09 |::DoUpda|te().{..|
|00002f70| 42 65 67 69 6e 55 70 64 | 61 74 65 28 66 44 6f 63 |BeginUpd|ate(fDoc|
|00002f80| 57 69 6e 64 6f 77 29 3b | 09 09 09 09 2f 2f 20 74 |Window);|....// t|
|00002f90| 68 69 73 20 73 65 74 73 | 20 75 70 20 74 68 65 20 |his sets| up the |
|00002fa0| 76 69 73 52 67 6e 20 0d | 09 69 66 20 28 20 21 20 |visRgn .|.if ( ! |
|00002fb0| 45 6d 70 74 79 52 67 6e | 28 66 44 6f 63 57 69 6e |EmptyRgn|(fDocWin|
|00002fc0| 64 6f 77 2d 3e 76 69 73 | 52 67 6e 29 20 29 09 2f |dow->vis|Rgn) )./|
|00002fd0| 2f 20 64 72 61 77 20 69 | 66 20 75 70 64 61 74 69 |/ draw i|f updati|
|00002fe0| 6e 67 20 6e 65 65 64 73 | 20 74 6f 20 62 65 20 64 |ng needs| to be d|
|00002ff0| 6f 6e 65 20 0d 09 20 20 | 7b 0d 09 09 44 72 61 77 |one .. |{...Draw|
|00003000| 57 69 6e 64 6f 77 28 29 | 3b 0d 09 20 20 7d 0d 09 |Window()|;.. }..|
|00003010| 45 6e 64 55 70 64 61 74 | 65 28 66 44 6f 63 57 69 |EndUpdat|e(fDocWi|
|00003020| 6e 64 6f 77 29 3b 0d 7d | 0d 0d 2f 2f 20 63 61 6c |ndow);.}|..// cal|
|00003030| 63 75 6c 61 74 65 20 68 | 6f 77 20 6d 75 63 68 20 |culate h|ow much |
|00003040| 69 64 6c 65 20 74 69 6d | 65 20 77 65 20 6e 65 65 |idle tim|e we nee|
|00003050| 64 0d 0d 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |d..unsig|ned long|
|00003060| 20 54 45 44 6f 63 75 6d | 65 6e 74 3a 3a 43 61 6c | TEDocum|ent::Cal|
|00003070| 63 49 64 6c 65 28 29 0d | 7b 0d 09 69 66 20 28 48 |cIdle().|{..if (H|
|00003080| 61 76 65 53 65 6c 65 63 | 74 69 6f 6e 28 29 29 0d |aveSelec|tion()).|
|00003090| 09 20 20 72 65 74 75 72 | 6e 20 47 65 74 43 61 72 |. retur|n GetCar|
|000030a0| 65 74 54 69 6d 65 28 29 | 3b 0d 09 65 6c 73 65 20 |etTime()|;..else |
|000030b0| 72 65 74 75 72 6e 20 6b | 4d 61 78 53 6c 65 65 70 |return k|MaxSleep|
|000030c0| 54 69 6d 65 3b 09 2f 2f | 20 69 66 20 77 65 20 64 |Time;.//| if we d|
|000030d0| 6f 6e 27 74 20 68 61 76 | 65 20 61 20 73 65 6c 65 |on't hav|e a sele|
|000030e0| 63 74 69 6f 6e 2c 20 77 | 65 20 64 6f 6e 27 74 20 |ction, w|e don't |
|000030f0| 6e 65 65 64 20 74 6f 20 | 69 64 6c 65 0d 7d 0d 0d |need to |idle.}..|
|00003100| 2f 2f 20 54 68 69 73 20 | 69 73 20 63 61 6c 6c 65 |// This |is calle|
|00003110| 64 20 77 68 65 6e 65 76 | 65 72 20 77 65 20 67 65 |d whenev|er we ge|
|00003120| 74 20 61 20 6e 75 6c 6c | 20 65 76 65 6e 74 20 65 |t a null| event e|
|00003130| 74 20 61 6c 2e 0d 2f 2f | 20 49 74 20 74 61 6b 65 |t al..//| It take|
|00003140| 73 20 63 61 72 65 20 6f | 66 20 6e 65 63 65 73 73 |s care o|f necess|
|00003150| 61 72 79 20 70 65 72 69 | 6f 64 69 63 20 61 63 74 |ary peri|odic act|
|00003160| 69 6f 6e 73 2e 20 46 6f | 72 20 74 68 69 73 20 70 |ions. Fo|r this p|
|00003170| 72 6f 67 72 61 6d 2c 0d | 2f 2f 20 69 74 20 63 61 |rogram,.|// it ca|
|00003180| 6c 6c 73 20 54 45 49 64 | 6c 65 2e 0d 0d 76 6f 69 |lls TEId|le...voi|
|00003190| 64 20 54 45 44 6f 63 75 | 6d 65 6e 74 3a 3a 44 6f |d TEDocu|ment::Do|
|000031a0| 49 64 6c 65 28 29 0d 7b | 0d 09 54 45 49 64 6c 65 |Idle().{|..TEIdle|
|000031b0| 28 66 44 6f 63 54 45 29 | 3b 0d 7d 20 2f 2f 20 44 |(fDocTE)|;.} // D|
|000031c0| 6f 49 64 6c 65 0d 0d 2f | 2f 20 44 72 61 77 20 74 |oIdle../|/ Draw t|
|000031d0| 68 65 20 63 6f 6e 74 65 | 6e 74 73 20 6f 66 20 61 |he conte|nts of a|
|000031e0| 6e 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 77 69 |n applic|ation wi|
|000031f0| 6e 64 6f 77 2e 20 0d 0d | 76 6f 69 64 20 54 45 44 |ndow. ..|void TED|
|00003200| 6f 63 75 6d 65 6e 74 3a | 3a 44 72 61 77 57 69 6e |ocument:|:DrawWin|
|00003210| 64 6f 77 28 29 0d 7b 0d | 09 52 65 63 74 20 74 52 |dow().{.|.Rect tR|
|00003220| 65 63 74 3b 0d 0d 09 53 | 65 74 50 6f 72 74 28 66 |ect;...S|etPort(f|
|00003230| 44 6f 63 57 69 6e 64 6f | 77 29 3b 0d 09 74 52 65 |DocWindo|w);..tRe|
|00003240| 63 74 20 3d 20 66 44 6f | 63 57 69 6e 64 6f 77 2d |ct = fDo|cWindow-|
|00003250| 3e 70 6f 72 74 52 65 63 | 74 3b 0d 09 45 72 61 73 |>portRec|t;..Eras|
|00003260| 65 52 65 63 74 28 26 74 | 52 65 63 74 29 3b 0d 09 |eRect(&t|Rect);..|
|00003270| 54 45 55 70 64 61 74 65 | 28 26 74 52 65 63 74 2c |TEUpdate|(&tRect,|
|00003280| 20 66 44 6f 63 54 45 29 | 3b 0d 09 44 72 61 77 43 | fDocTE)|;..DrawC|
|00003290| 6f 6e 74 72 6f 6c 73 28 | 66 44 6f 63 57 69 6e 64 |ontrols(|fDocWind|
|000032a0| 6f 77 29 3b 0d 09 44 72 | 61 77 47 72 6f 77 49 63 |ow);..Dr|awGrowIc|
|000032b0| 6f 6e 28 66 44 6f 63 57 | 69 6e 64 6f 77 29 3b 0d |on(fDocW|indow);.|
|000032c0| 7d 20 2f 2f 20 44 72 61 | 77 57 69 6e 64 6f 77 0d |} // Dra|wWindow.|
|000032d0| 0d 2f 2f 20 52 65 74 75 | 72 6e 20 61 20 72 65 63 |.// Retu|rn a rec|
|000032e0| 74 61 6e 67 6c 65 20 74 | 68 61 74 20 69 73 20 69 |tangle t|hat is i|
|000032f0| 6e 73 65 74 20 66 72 6f | 6d 20 74 68 65 20 70 6f |nset fro|m the po|
|00003300| 72 74 52 65 63 74 20 62 | 79 20 74 68 65 20 73 69 |rtRect b|y the si|
|00003310| 7a 65 20 6f 66 0d 2f 2f | 20 74 68 65 20 73 63 72 |ze of.//| the scr|
|00003320| 6f 6c 6c 62 61 72 73 20 | 61 6e 64 20 61 20 6c 69 |ollbars |and a li|
|00003330| 74 74 6c 65 20 65 78 74 | 72 61 20 6d 61 72 67 69 |ttle ext|ra margi|
|00003340| 6e 2e 0d 0d 76 6f 69 64 | 20 54 45 44 6f 63 75 6d |n...void| TEDocum|
|00003350| 65 6e 74 3a 3a 47 65 74 | 54 45 52 65 63 74 28 52 |ent::Get|TERect(R|
|00003360| 65 63 74 2a 20 74 65 52 | 65 63 74 29 0d 7b 0d 09 |ect* teR|ect).{..|
|00003370| 2a 74 65 52 65 63 74 20 | 3d 20 66 44 6f 63 57 69 |*teRect |= fDocWi|
|00003380| 6e 64 6f 77 2d 3e 70 6f | 72 74 52 65 63 74 3b 0d |ndow->po|rtRect;.|
|00003390| 09 49 6e 73 65 74 52 65 | 63 74 28 74 65 52 65 63 |.InsetRe|ct(teRec|
|000033a0| 74 2c 20 6b 54 65 78 74 | 4d 61 72 67 69 6e 2c 20 |t, kText|Margin, |
|000033b0| 6b 54 65 78 74 4d 61 72 | 67 69 6e 29 3b 09 09 09 |kTextMar|gin);...|
|000033c0| 2f 2f 20 61 64 6a 75 73 | 74 20 66 6f 72 20 6d 61 |// adjus|t for ma|
|000033d0| 72 67 69 6e 20 0d 09 74 | 65 52 65 63 74 2d 3e 62 |rgin ..t|eRect->b|
|000033e0| 6f 74 74 6f 6d 20 3d 20 | 74 65 52 65 63 74 2d 3e |ottom = |teRect->|
|000033f0| 62 6f 74 74 6f 6d 20 2d | 20 6b 53 63 72 6f 6c 6c |bottom -| kScroll|
|00003400| 62 61 72 41 64 6a 75 73 | 74 3b 09 2f 2f 20 61 6e |barAdjus|t;.// an|
|00003410| 64 20 66 6f 72 20 74 68 | 65 20 73 63 72 6f 6c 6c |d for th|e scroll|
|00003420| 62 61 72 73 20 0d 09 74 | 65 52 65 63 74 2d 3e 72 |bars ..t|eRect->r|
|00003430| 69 67 68 74 20 3d 20 74 | 65 52 65 63 74 2d 3e 72 |ight = t|eRect->r|
|00003440| 69 67 68 74 20 2d 20 6b | 53 63 72 6f 6c 6c 62 61 |ight - k|Scrollba|
|00003450| 72 41 64 6a 75 73 74 3b | 0d 7d 20 2f 2f 20 47 65 |rAdjust;|.} // Ge|
|00003460| 74 54 45 52 65 63 74 0d | 0d 2f 2f 20 73 65 74 75 |tTERect.|.// setu|
|00003470| 70 20 61 20 72 65 67 69 | 6f 6e 20 77 68 69 63 68 |p a regi|on which|
|00003480| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 20 76 69 | contain|s the vi|
|00003490| 73 69 62 6c 65 20 74 65 | 78 74 0d 0d 76 6f 69 64 |sible te|xt..void|
|000034a0| 20 54 45 44 6f 63 75 6d | 65 6e 74 3a 3a 47 65 74 | TEDocum|ent::Get|
|000034b0| 56 69 73 54 45 52 67 6e | 28 52 67 6e 48 61 6e 64 |VisTERgn|(RgnHand|
|000034c0| 6c 65 20 72 67 6e 29 0d | 7b 0d 09 52 65 63 74 20 |le rgn).|{..Rect |
|000034d0| 74 65 52 65 63 74 3b 0d | 0d 09 74 65 52 65 63 74 |teRect;.|..teRect|
|000034e0| 20 3d 20 28 2a 66 44 6f | 63 54 45 29 2d 3e 76 69 | = (*fDo|cTE)->vi|
|000034f0| 65 77 52 65 63 74 3b 09 | 2f 2f 20 67 65 74 20 61 |ewRect;.|// get a|
|00003500| 20 6c 6f 63 61 6c 20 63 | 6f 70 79 20 6f 66 20 76 | local c|opy of v|
|00003510| 69 65 77 52 65 63 74 0d | 09 53 65 74 50 6f 72 74 |iewRect.|.SetPort|
|00003520| 28 66 44 6f 63 57 69 6e | 64 6f 77 29 3b 09 09 09 |(fDocWin|dow);...|
|00003530| 2f 2f 20 6d 61 6b 65 20 | 73 75 72 65 20 77 65 20 |// make |sure we |
|00003540| 68 61 76 65 20 72 69 67 | 68 74 20 70 6f 72 74 0d |have rig|ht port.|
|00003550| 09 4c 6f 63 61 6c 54 6f | 47 6c 6f 62 61 6c 28 26 |.LocalTo|Global(&|
|00003560| 54 6f 70 4c 65 66 74 28 | 74 65 52 65 63 74 29 29 |TopLeft(|teRect))|
|00003570| 3b 0d 09 4c 6f 63 61 6c | 54 6f 47 6c 6f 62 61 6c |;..Local|ToGlobal|
|00003580| 28 26 42 6f 74 52 69 67 | 68 74 28 74 65 52 65 63 |(&BotRig|ht(teRec|
|00003590| 74 29 29 3b 0d 09 52 65 | 63 74 52 67 6e 28 72 67 |t));..Re|ctRgn(rg|
|000035a0| 6e 2c 20 26 74 65 52 65 | 63 74 29 3b 0d 09 2f 2f |n, &teRe|ct);..//|
|000035b0| 20 77 65 20 74 65 6d 70 | 6f 72 61 72 69 6c 79 20 | we temp|orarily |
|000035c0| 63 68 61 6e 67 65 20 74 | 68 65 20 70 6f 72 74 d5 |change t|he port.|
|000035d0| 73 20 6f 72 69 67 69 6e | 20 74 6f 20 d2 67 6c 6f |s origin| to .glo|
|000035e0| 62 61 6c 66 79 d3 20 74 | 68 65 20 76 69 73 52 67 |balfy. t|he visRg|
|000035f0| 6e 0d 09 53 65 74 4f 72 | 69 67 69 6e 28 2d 28 66 |n..SetOr|igin(-(f|
|00003600| 44 6f 63 57 69 6e 64 6f | 77 2d 3e 70 6f 72 74 42 |DocWindo|w->portB|
|00003610| 69 74 73 2e 62 6f 75 6e | 64 73 2e 6c 65 66 74 29 |its.boun|ds.left)|
|00003620| 2c 0d 09 09 09 20 20 2d | 28 66 44 6f 63 57 69 6e |,.... -|(fDocWin|
|00003630| 64 6f 77 2d 3e 70 6f 72 | 74 42 69 74 73 2e 62 6f |dow->por|tBits.bo|
|00003640| 75 6e 64 73 2e 74 6f 70 | 29 29 3b 0d 09 53 65 63 |unds.top|));..Sec|
|00003650| 74 52 67 6e 28 72 67 6e | 2c 20 66 44 6f 63 57 69 |tRgn(rgn|, fDocWi|
|00003660| 6e 64 6f 77 2d 3e 76 69 | 73 52 67 6e 2c 20 72 67 |ndow->vi|sRgn, rg|
|00003670| 6e 29 3b 0d 09 53 65 74 | 4f 72 69 67 69 6e 28 30 |n);..Set|Origin(0|
|00003680| 2c 20 30 29 3b 0d 7d 20 | 2f 2f 20 47 65 74 54 45 |, 0);.} |// GetTE|
|00003690| 52 67 6e 0d 0d 2f 2f 20 | 52 65 74 75 72 6e 20 62 |Rgn..// |Return b|
|000036a0| 6f 6f 6c 65 61 6e 20 76 | 61 6c 75 65 20 69 6e 64 |oolean v|alue ind|
|000036b0| 69 63 61 74 69 6e 67 20 | 74 68 61 74 20 74 68 65 |icating |that the|
|000036c0| 72 65 20 69 73 20 6f 72 | 20 69 73 20 6e 6f 74 20 |re is or| is not |
|000036d0| 61 0d 2f 2f 20 73 65 6c | 65 63 74 69 6f 6e 20 69 |a.// sel|ection i|
|000036e0| 6e 20 74 68 65 20 64 6f | 63 75 6d 65 6e 74 0d 0d |n the do|cument..|
|000036f0| 42 6f 6f 6c 65 61 6e 20 | 54 45 44 6f 63 75 6d 65 |Boolean |TEDocume|
|00003700| 6e 74 3a 3a 48 61 76 65 | 53 65 6c 65 63 74 69 6f |nt::Have|Selectio|
|00003710| 6e 28 29 0d 7b 0d 09 69 | 66 20 28 20 28 2a 66 44 |n().{..i|f ( (*fD|
|00003720| 6f 63 54 45 29 2d 3e 73 | 65 6c 53 74 61 72 74 20 |ocTE)->s|elStart |
|00003730| 3c 20 28 2a 66 44 6f 63 | 54 45 29 2d 3e 73 65 6c |< (*fDoc|TE)->sel|
|00003740| 45 6e 64 20 29 0d 09 20 | 20 72 65 74 75 72 6e 20 |End ).. | return |
|00003750| 74 72 75 65 3b 0d 09 65 | 6c 73 65 20 72 65 74 75 |true;..e|lse retu|
|00003760| 72 6e 20 66 61 6c 73 65 | 3b 0d 7d 0d 0d 2f 2f 20 |rn false|;.}..// |
|00003770| 55 70 64 61 74 65 20 74 | 68 65 20 54 45 52 65 63 |Update t|he TERec|
|00003780| 27 73 20 76 69 65 77 20 | 72 65 63 74 20 73 6f 20 |'s view |rect so |
|00003790| 74 68 61 74 20 69 74 20 | 69 73 20 74 68 65 20 67 |that it |is the g|
|000037a0| 72 65 61 74 65 73 74 20 | 6d 75 6c 74 69 70 6c 65 |reatest |multiple|
|000037b0| 20 6f 66 0d 2f 2f 20 74 | 68 65 20 6c 69 6e 65 48 | of.// t|he lineH|
|000037c0| 65 69 67 68 74 20 74 68 | 61 74 20 73 74 69 6c 6c |eight th|at still|
|000037d0| 20 66 69 74 73 20 69 6e | 20 74 68 65 20 6f 6c 64 | fits in| the old|
|000037e0| 20 76 69 65 77 52 65 63 | 74 2e 0d 0d 76 6f 69 64 | viewRec|t...void|
|000037f0| 20 54 45 44 6f 63 75 6d | 65 6e 74 3a 3a 41 64 6a | TEDocum|ent::Adj|
|00003800| 75 73 74 56 69 65 77 52 | 65 63 74 28 29 0d 7b 0d |ustViewR|ect().{.|
|00003810| 09 54 45 50 74 72 20 74 | 65 3b 0d 09 0d 09 74 65 |.TEPtr t|e;....te|
|00003820| 20 3d 20 2a 66 44 6f 63 | 54 45 3b 0d 09 74 65 2d | = *fDoc|TE;..te-|
|00003830| 3e 76 69 65 77 52 65 63 | 74 2e 62 6f 74 74 6f 6d |>viewRec|t.bottom|
|00003840| 20 3d 20 28 28 28 74 65 | 2d 3e 76 69 65 77 52 65 | = (((te|->viewRe|
|00003850| 63 74 2e 62 6f 74 74 6f | 6d 20 2d 20 74 65 2d 3e |ct.botto|m - te->|
|00003860| 76 69 65 77 52 65 63 74 | 2e 74 6f 70 29 20 2f 20 |viewRect|.top) / |
|00003870| 74 65 2d 3e 6c 69 6e 65 | 48 65 69 67 68 74 29 0d |te->line|Height).|
|00003880| 09 09 09 09 09 09 09 2a | 20 74 65 2d 3e 6c 69 6e |.......*| te->lin|
|00003890| 65 48 65 69 67 68 74 29 | 20 2b 20 74 65 2d 3e 76 |eHeight)| + te->v|
|000038a0| 69 65 77 52 65 63 74 2e | 74 6f 70 3b 0d 7d 20 2f |iewRect.|top;.} /|
|000038b0| 2f 20 41 64 6a 75 73 74 | 56 69 65 77 52 65 63 74 |/ Adjust|ViewRect|
|000038c0| 0d 0d 2f 2f 20 53 63 72 | 6f 6c 6c 20 74 68 65 20 |..// Scr|oll the |
|000038d0| 54 45 52 65 63 20 61 72 | 6f 75 6e 64 20 74 6f 20 |TERec ar|ound to |
|000038e0| 6d 61 74 63 68 20 75 70 | 20 74 6f 20 74 68 65 20 |match up| to the |
|000038f0| 70 6f 74 65 6e 74 69 61 | 6c 6c 79 20 75 70 64 61 |potentia|lly upda|
|00003900| 74 65 64 20 73 63 72 6f | 6c 6c 62 61 72 0d 2f 2f |ted scro|llbar.//|
|00003910| 20 76 61 6c 75 65 73 2e | 20 54 68 69 73 20 69 73 | values.| This is|
|00003920| 20 72 65 61 6c 6c 79 20 | 75 73 65 66 75 6c 20 77 | really |useful w|
|00003930| 68 65 6e 20 74 68 65 20 | 77 69 6e 64 6f 77 20 68 |hen the |window h|
|00003940| 61 73 20 62 65 65 6e 20 | 72 65 73 69 7a 65 64 20 |as been |resized |
|00003950| 73 75 63 68 20 74 68 61 | 74 20 74 68 65 0d 2f 2f |such tha|t the.//|
|00003960| 20 73 63 72 6f 6c 6c 62 | 61 72 73 20 62 65 63 61 | scrollb|ars beca|
|00003970| 6d 65 20 69 6e 61 63 74 | 69 76 65 20 62 75 74 20 |me inact|ive but |
|00003980| 74 68 65 20 54 45 52 65 | 63 20 77 61 73 20 61 6c |the TERe|c was al|
|00003990| 72 65 61 64 79 20 73 63 | 72 6f 6c 6c 65 64 2e 0d |ready sc|rolled..|
|000039a0| 0d 76 6f 69 64 20 54 45 | 44 6f 63 75 6d 65 6e 74 |.void TE|Document|
|000039b0| 3a 3a 41 64 6a 75 73 74 | 54 45 28 29 0d 7b 0d 09 |::Adjust|TE().{..|
|000039c0| 54 45 50 74 72 20 74 65 | 3b 0d 09 0d 09 74 65 20 |TEPtr te|;....te |
|000039d0| 3d 20 2a 66 44 6f 63 54 | 45 3b 0d 09 54 45 53 63 |= *fDocT|E;..TESc|
|000039e0| 72 6f 6c 6c 28 28 74 65 | 2d 3e 76 69 65 77 52 65 |roll((te|->viewRe|
|000039f0| 63 74 2e 6c 65 66 74 20 | 2d 20 74 65 2d 3e 64 65 |ct.left |- te->de|
|00003a00| 73 74 52 65 63 74 2e 6c | 65 66 74 29 20 2d 20 47 |stRect.l|eft) - G|
|00003a10| 65 74 43 74 6c 56 61 6c | 75 65 28 66 44 6f 63 48 |etCtlVal|ue(fDocH|
|00003a20| 53 63 72 6f 6c 6c 29 2c | 0d 09 09 09 20 28 74 65 |Scroll),|.... (te|
|00003a30| 2d 3e 76 69 65 77 52 65 | 63 74 2e 74 6f 70 20 2d |->viewRe|ct.top -|
|00003a40| 20 74 65 2d 3e 64 65 73 | 74 52 65 63 74 2e 74 6f | te->des|tRect.to|
|00003a50| 70 29 20 2d 20 0d 09 09 | 09 20 09 28 47 65 74 43 |p) - ...|. .(GetC|
|00003a60| 74 6c 56 61 6c 75 65 28 | 66 44 6f 63 56 53 63 72 |tlValue(|fDocVScr|
|00003a70| 6f 6c 6c 29 20 2a 20 74 | 65 2d 3e 6c 69 6e 65 48 |oll) * t|e->lineH|
|00003a80| 65 69 67 68 74 29 2c 0d | 09 09 09 20 66 44 6f 63 |eight),.|... fDoc|
|00003a90| 54 45 29 3b 0d 7d 20 2f | 2f 20 41 64 6a 75 73 74 |TE);.} /|/ Adjust|
|00003aa0| 54 45 0d 0d 2f 2f 20 52 | 65 2d 63 61 6c 63 75 6c |TE..// R|e-calcul|
|00003ab0| 61 74 65 20 74 68 65 20 | 70 6f 73 69 74 69 6f 6e |ate the |position|
|00003ac0| 20 61 6e 64 20 73 69 7a | 65 20 6f 66 20 74 68 65 | and siz|e of the|
|00003ad0| 20 76 69 65 77 52 65 63 | 74 20 61 6e 64 20 74 68 | viewRec|t and th|
|00003ae0| 65 20 73 63 72 6f 6c 6c | 62 61 72 73 2e 0d 2f 2f |e scroll|bars..//|
|00003af0| 20 6b 53 63 72 6f 6c 6c | 54 77 65 65 6b 20 63 6f | kScroll|Tweek co|
|00003b00| 6d 70 65 6e 73 61 74 65 | 73 20 66 6f 72 20 6f 66 |mpensate|s for of|
|00003b10| 66 2d 62 79 2d 6f 6e 65 | 20 72 65 71 75 69 72 65 |f-by-one| require|
|00003b20| 6d 65 6e 74 73 20 6f 66 | 20 74 68 65 20 73 63 72 |ments of| the scr|
|00003b30| 6f 6c 6c 62 61 72 73 0d | 2f 2f 20 74 6f 20 68 61 |ollbars.|// to ha|
|00003b40| 76 65 20 62 6f 72 64 65 | 72 73 20 63 6f 69 6e 63 |ve borde|rs coinc|
|00003b50| 69 64 65 20 77 69 74 68 | 20 74 68 65 20 67 72 6f |ide with| the gro|
|00003b60| 77 62 6f 78 2e 0d 0d 76 | 6f 69 64 20 54 45 44 6f |wbox...v|oid TEDo|
|00003b70| 63 75 6d 65 6e 74 3a 3a | 41 64 6a 75 73 74 53 63 |cument::|AdjustSc|
|00003b80| 72 6f 6c 6c 53 69 7a 65 | 73 28 29 0d 7b 0d 09 52 |rollSize|s().{..R|
|00003b90| 65 63 74 20 74 65 52 65 | 63 74 3b 0d 09 0d 09 47 |ect teRe|ct;....G|
|00003ba0| 65 74 54 45 52 65 63 74 | 28 26 74 65 52 65 63 74 |etTERect|(&teRect|
|00003bb0| 29 3b 0d 09 28 2a 66 44 | 6f 63 54 45 29 2d 3e 76 |);..(*fD|ocTE)->v|
|00003bc0| 69 65 77 52 65 63 74 20 | 3d 20 74 65 52 65 63 74 |iewRect |= teRect|
|00003bd0| 3b 0d 09 41 64 6a 75 73 | 74 56 69 65 77 52 65 63 |;..Adjus|tViewRec|
|00003be0| 74 28 29 3b 0d 09 4d 6f | 76 65 43 6f 6e 74 72 6f |t();..Mo|veContro|
|00003bf0| 6c 28 66 44 6f 63 56 53 | 63 72 6f 6c 6c 2c 20 66 |l(fDocVS|croll, f|
|00003c00| 44 6f 63 57 69 6e 64 6f | 77 2d 3e 70 6f 72 74 52 |DocWindo|w->portR|
|00003c10| 65 63 74 2e 72 69 67 68 | 74 20 2d 20 6b 53 63 72 |ect.righ|t - kScr|
|00003c20| 6f 6c 6c 62 61 72 41 64 | 6a 75 73 74 2c 20 2d 31 |ollbarAd|just, -1|
|00003c30| 29 3b 0d 09 53 69 7a 65 | 43 6f 6e 74 72 6f 6c 28 |);..Size|Control(|
|00003c40| 66 44 6f 63 56 53 63 72 | 6f 6c 6c 2c 20 6b 53 63 |fDocVScr|oll, kSc|
|00003c50| 72 6f 6c 6c 62 61 72 57 | 69 64 74 68 2c 0d 09 09 |rollbarW|idth,...|
|00003c60| 09 09 66 44 6f 63 57 69 | 6e 64 6f 77 2d 3e 70 6f |..fDocWi|ndow->po|
|00003c70| 72 74 52 65 63 74 2e 62 | 6f 74 74 6f 6d 20 2d 20 |rtRect.b|ottom - |
|00003c80| 66 44 6f 63 57 69 6e 64 | 6f 77 2d 3e 70 6f 72 74 |fDocWind|ow->port|
|00003c90| 52 65 63 74 2e 74 6f 70 | 20 2d 0d 09 09 09 09 09 |Rect.top| -......|
|00003ca0| 6b 47 72 6f 77 62 6f 78 | 41 64 6a 75 73 74 20 2b |kGrowbox|Adjust +|
|00003cb0| 20 6b 53 63 72 6f 6c 6c | 54 77 65 65 6b 29 3b 0d | kScroll|Tweek);.|
|00003cc0| 09 4d 6f 76 65 43 6f 6e | 74 72 6f 6c 28 66 44 6f |.MoveCon|trol(fDo|
|00003cd0| 63 48 53 63 72 6f 6c 6c | 2c 20 2d 31 2c 20 66 44 |cHScroll|, -1, fD|
|00003ce0| 6f 63 57 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |ocWindow|->portRe|
|00003cf0| 63 74 2e 62 6f 74 74 6f | 6d 20 2d 20 6b 53 63 72 |ct.botto|m - kScr|
|00003d00| 6f 6c 6c 62 61 72 41 64 | 6a 75 73 74 29 3b 0d 09 |ollbarAd|just);..|
|00003d10| 53 69 7a 65 43 6f 6e 74 | 72 6f 6c 28 66 44 6f 63 |SizeCont|rol(fDoc|
|00003d20| 48 53 63 72 6f 6c 6c 2c | 0d 09 09 09 09 66 44 6f |HScroll,|.....fDo|
|00003d30| 63 57 69 6e 64 6f 77 2d | 3e 70 6f 72 74 52 65 63 |cWindow-|>portRec|
|00003d40| 74 2e 72 69 67 68 74 20 | 2d 20 66 44 6f 63 57 69 |t.right |- fDocWi|
|00003d50| 6e 64 6f 77 2d 3e 70 6f | 72 74 52 65 63 74 2e 6c |ndow->po|rtRect.l|
|00003d60| 65 66 74 20 2d 0d 09 09 | 09 09 09 6b 47 72 6f 77 |eft -...|...kGrow|
|00003d70| 62 6f 78 41 64 6a 75 73 | 74 20 2b 20 6b 53 63 72 |boxAdjus|t + kScr|
|00003d80| 6f 6c 6c 54 77 65 65 6b | 2c 0d 09 09 09 09 6b 53 |ollTweek|,.....kS|
|00003d90| 63 72 6f 6c 6c 62 61 72 | 57 69 64 74 68 29 3b 0d |crollbar|Width);.|
|00003da0| 7d 20 2f 2f 20 41 64 6a | 75 73 74 53 63 72 6f 6c |} // Adj|ustScrol|
|00003db0| 6c 53 69 7a 65 73 0d 0d | 2f 2f 20 54 75 72 6e 20 |lSizes..|// Turn |
|00003dc0| 6f 66 66 20 74 68 65 20 | 63 6f 6e 74 72 6f 6c 73 |off the |controls|
|00003dd0| 20 62 79 20 6a 61 6d 6d | 69 6e 67 20 61 20 7a 65 | by jamm|ing a ze|
|00003de0| 72 6f 20 69 6e 74 6f 20 | 74 68 65 69 72 20 63 6f |ro into |their co|
|00003df0| 6e 74 72 6c 56 69 73 20 | 66 69 65 6c 64 73 20 28 |ntrlVis |fields (|
|00003e00| 48 69 64 65 43 6f 6e 74 | 72 6f 6c 20 65 72 61 73 |HideCont|rol eras|
|00003e10| 65 73 20 74 68 65 6d 0d | 2f 2f 20 61 6e 64 20 77 |es them.|// and w|
|00003e20| 65 20 64 6f 6e 27 74 20 | 77 61 6e 74 20 74 68 61 |e don't |want tha|
|00003e30| 74 29 2e 20 49 66 20 74 | 68 65 20 63 6f 6e 74 72 |t). If t|he contr|
|00003e40| 6f 6c 73 20 61 72 65 20 | 74 6f 20 62 65 20 72 65 |ols are |to be re|
|00003e50| 73 69 7a 65 64 20 61 73 | 20 77 65 6c 6c 2c 20 63 |sized as| well, c|
|00003e60| 61 6c 6c 20 74 68 65 20 | 70 72 6f 63 65 64 75 72 |all the |procedur|
|00003e70| 65 20 74 6f 20 64 6f 20 | 74 68 61 74 2c 0d 2f 2f |e to do |that,.//|
|00003e80| 20 74 68 65 6e 20 63 61 | 6c 6c 20 74 68 65 20 70 | then ca|ll the p|
|00003e90| 72 6f 63 65 64 75 72 65 | 20 74 6f 20 61 64 6a 75 |rocedure| to adju|
|00003ea0| 73 74 20 74 68 65 20 6d | 61 78 69 6d 75 6d 20 61 |st the m|aximum a|
|00003eb0| 6e 64 20 63 75 72 72 65 | 6e 74 20 76 61 6c 75 65 |nd curre|nt value|
|00003ec0| 73 2e 20 46 69 6e 61 6c | 6c 79 20 72 65 2d 65 6e |s. Final|ly re-en|
|00003ed0| 61 62 6c 65 20 74 68 65 | 20 63 6f 6e 74 72 6f 6c |able the| control|
|00003ee0| 73 0d 2f 2f 20 62 79 20 | 6a 61 6d 6d 69 6e 67 20 |s.// by |jamming |
|00003ef0| 61 20 24 46 46 20 69 6e | 20 74 68 65 69 72 20 63 |a $FF in| their c|
|00003f00| 6f 6e 74 72 6c 56 69 73 | 20 66 69 65 6c 64 73 20 |ontrlVis| fields |
|00003f10| 28 53 68 6f 77 43 6f 6e | 74 72 6f 6c 20 72 65 2d |(ShowCon|trol re-|
|00003f20| 64 72 61 77 73 20 74 68 | 65 20 63 6f 6e 74 72 6f |draws th|e contro|
|00003f30| 6c 2c 20 77 68 69 63 68 | 20 6d 61 79 20 6e 6f 74 |l, which| may not|
|00003f40| 20 62 65 0d 2f 2f 20 6e | 65 63 65 73 73 61 72 79 | be.// n|ecessary|
|00003f50| 29 2e 0d 0d 76 6f 69 64 | 20 54 45 44 6f 63 75 6d |)...void| TEDocum|
|00003f60| 65 6e 74 3a 3a 41 64 6a | 75 73 74 53 63 72 6f 6c |ent::Adj|ustScrol|
|00003f70| 6c 62 61 72 73 28 42 6f | 6f 6c 65 61 6e 20 6e 65 |lbars(Bo|olean ne|
|00003f80| 65 64 73 52 65 73 69 7a | 65 29 0d 7b 0d 09 2f 2f |edsResiz|e).{..//|
|00003f90| 20 46 69 72 73 74 2c 20 | 74 75 72 6e 20 76 69 73 | First, |turn vis|
|00003fa0| 69 62 69 6c 69 74 79 20 | 6f 66 20 73 63 72 6f 6c |ibility |of scrol|
|00003fb0| 6c 62 61 72 73 20 6f 66 | 66 20 73 6f 20 77 65 20 |lbars of|f so we |
|00003fc0| 77 6f 6e d5 74 20 67 65 | 74 20 75 6e 77 61 6e 74 |won.t ge|t unwant|
|00003fd0| 65 64 20 72 65 64 72 61 | 77 69 6e 67 20 0d 09 28 |ed redra|wing ..(|
|00003fe0| 2a 66 44 6f 63 56 53 63 | 72 6f 6c 6c 29 2d 3e 63 |*fDocVSc|roll)->c|
|00003ff0| 6f 6e 74 72 6c 56 69 73 | 20 3d 20 30 3b 0d 09 28 |ontrlVis| = 0;..(|
|00004000| 2a 66 44 6f 63 48 53 63 | 72 6f 6c 6c 29 2d 3e 63 |*fDocHSc|roll)->c|
|00004010| 6f 6e 74 72 6c 56 69 73 | 20 3d 20 30 3b 0d 09 69 |ontrlVis| = 0;..i|
|00004020| 66 20 28 20 6e 65 65 64 | 73 52 65 73 69 7a 65 20 |f ( need|sResize |
|00004030| 29 0d 09 20 20 41 64 6a | 75 73 74 53 63 72 6f 6c |).. Adj|ustScrol|
|00004040| 6c 53 69 7a 65 73 28 29 | 3b 0d 09 41 64 6a 75 73 |lSizes()|;..Adjus|
|00004050| 74 53 63 72 6f 6c 6c 56 | 61 6c 75 65 73 28 6e 65 |tScrollV|alues(ne|
|00004060| 65 64 73 52 65 73 69 7a | 65 29 3b 0d 09 2f 2f 20 |edsResiz|e);..// |
|00004070| 4e 6f 77 2c 20 72 65 73 | 74 6f 72 65 20 76 69 73 |Now, res|tore vis|
|00004080| 69 62 69 6c 69 74 79 20 | 69 6e 20 63 61 73 65 20 |ibility |in case |
|00004090| 77 65 20 6e 65 76 65 72 | 20 68 61 64 20 74 6f 20 |we never| had to |
|000040a0| 64 72 61 77 20 64 75 72 | 69 6e 67 20 61 64 6a 75 |draw dur|ing adju|
|000040b0| 73 74 6d 65 6e 74 20 0d | 09 28 2a 66 44 6f 63 56 |stment .|.(*fDocV|
|000040c0| 53 63 72 6f 6c 6c 29 2d | 3e 63 6f 6e 74 72 6c 56 |Scroll)-|>contrlV|
|000040d0| 69 73 20 3d 20 30 78 66 | 66 3b 0d 09 28 2a 66 44 |is = 0xf|f;..(*fD|
|000040e0| 6f 63 48 53 63 72 6f 6c | 6c 29 2d 3e 63 6f 6e 74 |ocHScrol|l)->cont|
|000040f0| 72 6c 56 69 73 20 3d 20 | 30 78 66 66 3b 0d 7d 20 |rlVis = |0xff;.} |
|00004100| 2f 2f 20 41 64 6a 75 73 | 74 53 63 72 6f 6c 6c 62 |// Adjus|tScrollb|
|00004110| 61 72 73 20 0d 0d 2f 2f | 20 43 61 6c 63 75 6c 61 |ars ..//| Calcula|
|00004120| 74 65 20 74 68 65 20 6e | 65 77 20 63 6f 6e 74 72 |te the n|ew contr|
|00004130| 6f 6c 20 6d 61 78 69 6d | 75 6d 20 76 61 6c 75 65 |ol maxim|um value|
|00004140| 20 61 6e 64 20 63 75 72 | 72 65 6e 74 20 76 61 6c | and cur|rent val|
|00004150| 75 65 2c 20 77 68 65 74 | 68 65 72 20 69 74 20 69 |ue, whet|her it i|
|00004160| 73 20 74 68 65 20 68 6f | 72 69 7a 6f 6e 74 61 6c |s the ho|rizontal|
|00004170| 20 6f 72 0d 2f 2f 20 76 | 65 72 74 69 63 61 6c 20 | or.// v|ertical |
|00004180| 73 63 72 6f 6c 6c 62 61 | 72 2e 20 54 68 65 20 76 |scrollba|r. The v|
|00004190| 65 72 74 69 63 61 6c 20 | 6d 61 78 20 69 73 20 63 |ertical |max is c|
|000041a0| 61 6c 63 75 6c 61 74 65 | 64 20 62 79 20 63 6f 6d |alculate|d by com|
|000041b0| 70 61 72 69 6e 67 20 74 | 68 65 20 6e 75 6d 62 65 |paring t|he numbe|
|000041c0| 72 20 6f 66 20 6c 69 6e | 65 73 20 74 6f 20 74 68 |r of lin|es to th|
|000041d0| 65 0d 2f 2f 20 76 65 72 | 74 69 63 61 6c 20 73 69 |e.// ver|tical si|
|000041e0| 7a 65 20 6f 66 20 74 68 | 65 20 76 69 65 77 52 65 |ze of th|e viewRe|
|000041f0| 63 74 2e 20 54 68 65 20 | 68 6f 72 69 7a 6f 6e 74 |ct. The |horizont|
|00004200| 61 6c 20 6d 61 78 20 69 | 73 20 63 61 6c 63 75 6c |al max i|s calcul|
|00004210| 61 74 65 64 20 62 79 20 | 63 6f 6d 70 61 72 69 6e |ated by |comparin|
|00004220| 67 20 74 68 65 20 6d 61 | 78 69 6d 75 6d 20 64 6f |g the ma|ximum do|
|00004230| 63 75 6d 65 6e 74 0d 2f | 2f 20 77 69 64 74 68 20 |cument./|/ width |
|00004240| 74 6f 20 74 68 65 20 77 | 69 64 74 68 20 6f 66 20 |to the w|idth of |
|00004250| 74 68 65 20 76 69 65 77 | 52 65 63 74 2e 20 54 68 |the view|Rect. Th|
|00004260| 65 20 63 75 72 72 65 6e | 74 20 76 61 6c 75 65 73 |e curren|t values|
|00004270| 20 61 72 65 20 73 65 74 | 20 62 79 20 63 6f 6d 70 | are set| by comp|
|00004280| 61 72 69 6e 67 20 74 68 | 65 20 6f 66 66 73 65 74 |aring th|e offset|
|00004290| 20 62 65 74 77 65 65 6e | 0d 2f 2f 20 74 68 65 20 | between|.// the |
|000042a0| 76 69 65 77 20 61 6e 64 | 20 64 65 73 74 69 6e 61 |view and| destina|
|000042b0| 74 69 6f 6e 20 72 65 63 | 74 73 2e 20 49 66 20 6e |tion rec|ts. If n|
|000042c0| 65 63 65 73 73 61 72 79 | 2c 20 72 65 64 72 61 77 |ecessary|, redraw|
|000042d0| 20 74 68 65 20 63 6f 6e | 74 72 6f 6c 20 62 79 20 | the con|trol by |
|000042e0| 63 61 6c 6c 69 6e 67 20 | 53 68 6f 77 43 6f 6e 74 |calling |ShowCont|
|000042f0| 72 6f 6c 2e 0d 0d 76 6f | 69 64 20 54 45 44 6f 63 |rol...vo|id TEDoc|
|00004300| 75 6d 65 6e 74 3a 3a 41 | 64 6a 75 73 74 48 56 28 |ument::A|djustHV(|
|00004310| 42 6f 6f 6c 65 61 6e 20 | 69 73 56 65 72 74 2c 42 |Boolean |isVert,B|
|00004320| 6f 6f 6c 65 61 6e 20 6d | 75 73 74 52 65 64 72 61 |oolean m|ustRedra|
|00004330| 77 29 0d 7b 0d 09 73 68 | 6f 72 74 20 76 61 6c 75 |w).{..sh|ort valu|
|00004340| 65 2c 20 6c 69 6e 65 73 | 2c 20 6d 61 78 3b 0d 09 |e, lines|, max;..|
|00004350| 73 68 6f 72 74 20 6f 6c | 64 56 61 6c 75 65 2c 20 |short ol|dValue, |
|00004360| 6f 6c 64 4d 61 78 3b 0d | 09 54 45 50 74 72 20 74 |oldMax;.|.TEPtr t|
|00004370| 65 3b 0d 09 43 6f 6e 74 | 72 6f 6c 48 61 6e 64 6c |e;..Cont|rolHandl|
|00004380| 65 20 63 6f 6e 74 72 6f | 6c 3b 0d 0d 09 69 66 20 |e contro|l;...if |
|00004390| 28 69 73 56 65 72 74 29 | 0d 09 20 20 63 6f 6e 74 |(isVert)|.. cont|
|000043a0| 72 6f 6c 20 3d 20 66 44 | 6f 63 56 53 63 72 6f 6c |rol = fD|ocVScrol|
|000043b0| 6c 3b 0d 09 65 6c 73 65 | 20 63 6f 6e 74 72 6f 6c |l;..else| control|
|000043c0| 20 3d 20 66 44 6f 63 48 | 53 63 72 6f 6c 6c 3b 0d | = fDocH|Scroll;.|
|000043d0| 09 6f 6c 64 56 61 6c 75 | 65 20 3d 20 47 65 74 43 |.oldValu|e = GetC|
|000043e0| 74 6c 56 61 6c 75 65 28 | 63 6f 6e 74 72 6f 6c 29 |tlValue(|control)|
|000043f0| 3b 0d 09 6f 6c 64 4d 61 | 78 20 3d 20 47 65 74 43 |;..oldMa|x = GetC|
|00004400| 74 6c 4d 61 78 28 63 6f | 6e 74 72 6f 6c 29 3b 0d |tlMax(co|ntrol);.|
|00004410| 09 74 65 20 3d 20 2a 66 | 44 6f 63 54 45 3b 09 09 |.te = *f|DocTE;..|
|00004420| 09 09 09 09 09 2f 2f 20 | 70 6f 69 6e 74 20 74 6f |.....// |point to|
|00004430| 20 54 45 52 65 63 20 66 | 6f 72 20 63 6f 6e 76 65 | TERec f|or conve|
|00004440| 6e 69 65 6e 63 65 20 0d | 09 69 66 20 28 20 69 73 |nience .|.if ( is|
|00004450| 56 65 72 74 20 29 0d 09 | 20 20 7b 0d 09 09 6c 69 |Vert )..| {...li|
|00004460| 6e 65 73 20 3d 20 74 65 | 2d 3e 6e 4c 69 6e 65 73 |nes = te|->nLines|
|00004470| 3b 0d 09 09 2f 2f 20 73 | 69 6e 63 65 20 6e 4c 69 |;...// s|ince nLi|
|00004480| 6e 65 73 20 69 73 6e d5 | 74 20 72 69 67 68 74 20 |nes isn.|t right |
|00004490| 69 66 20 74 68 65 20 6c | 61 73 74 20 63 68 61 72 |if the l|ast char|
|000044a0| 61 63 74 65 72 20 69 73 | 20 61 20 72 65 74 75 72 |acter is| a retur|
|000044b0| 6e 2c 20 63 68 65 63 6b | 20 66 6f 72 20 74 68 61 |n, check| for tha|
|000044c0| 74 20 63 61 73 65 0d 09 | 09 69 66 20 28 20 2a 28 |t case..|.if ( *(|
|000044d0| 2a 74 65 2d 3e 68 54 65 | 78 74 20 2b 20 74 65 2d |*te->hTe|xt + te-|
|000044e0| 3e 74 65 4c 65 6e 67 74 | 68 20 2d 20 31 29 20 3d |>teLengt|h - 1) =|
|000044f0| 3d 20 6b 43 72 43 68 61 | 72 20 29 0d 09 09 20 20 |= kCrCha|r )... |
|00004500| 6c 69 6e 65 73 20 2b 3d | 20 31 3b 0d 09 09 6d 61 |lines +=| 1;...ma|
|00004510| 78 20 3d 20 6c 69 6e 65 | 73 20 2d 20 28 28 74 65 |x = line|s - ((te|
|00004520| 2d 3e 76 69 65 77 52 65 | 63 74 2e 62 6f 74 74 6f |->viewRe|ct.botto|
|00004530| 6d 20 2d 20 74 65 2d 3e | 76 69 65 77 52 65 63 74 |m - te->|viewRect|
|00004540| 2e 74 6f 70 29 20 2f 0d | 09 09 09 09 09 20 20 20 |.top) /.|..... |
|00004550| 74 65 2d 3e 6c 69 6e 65 | 48 65 69 67 68 74 29 3b |te->line|Height);|
|00004560| 0d 09 20 20 7d 0d 09 65 | 6c 73 65 20 6d 61 78 20 |.. }..e|lse max |
|00004570| 3d 20 6b 4d 61 78 44 6f | 63 57 69 64 74 68 20 2d |= kMaxDo|cWidth -|
|00004580| 20 28 74 65 2d 3e 76 69 | 65 77 52 65 63 74 2e 72 | (te->vi|ewRect.r|
|00004590| 69 67 68 74 20 2d 20 74 | 65 2d 3e 76 69 65 77 52 |ight - t|e->viewR|
|000045a0| 65 63 74 2e 6c 65 66 74 | 29 3b 0d 09 0d 09 69 66 |ect.left|);....if|
|000045b0| 20 28 20 6d 61 78 20 3c | 20 30 20 29 0d 09 20 20 | ( max <| 0 ).. |
|000045c0| 6d 61 78 20 3d 20 30 3b | 0d 09 53 65 74 43 74 6c |max = 0;|..SetCtl|
|000045d0| 4d 61 78 28 63 6f 6e 74 | 72 6f 6c 2c 20 6d 61 78 |Max(cont|rol, max|
|000045e0| 29 3b 0d 09 0d 09 2f 2f | 20 4d 75 73 74 20 64 65 |);....//| Must de|
|000045f0| 72 65 66 2e 20 61 66 74 | 65 72 20 53 65 74 43 74 |ref. aft|er SetCt|
|00004600| 6c 4d 61 78 20 73 69 6e | 63 65 2c 20 74 65 63 68 |lMax sin|ce, tech|
|00004610| 6e 69 63 61 6c 6c 79 2c | 20 69 74 20 63 6f 75 6c |nically,| it coul|
|00004620| 64 20 64 72 61 77 20 61 | 6e 64 20 74 68 65 72 65 |d draw a|nd there|
|00004630| 66 6f 72 65 20 6d 6f 76 | 65 0d 09 2f 2f 20 6d 65 |fore mov|e..// me|
|00004640| 6d 6f 72 79 2e 20 54 68 | 69 73 20 69 73 20 77 68 |mory. Th|is is wh|
|00004650| 79 20 77 65 20 64 6f 6e | d5 74 20 6a 75 73 74 20 |y we don|.t just |
|00004660| 64 6f 20 69 74 20 6f 6e | 63 65 20 61 74 20 74 68 |do it on|ce at th|
|00004670| 65 20 62 65 67 69 6e 6e | 69 6e 67 2e 0d 09 74 65 |e beginn|ing...te|
|00004680| 20 3d 20 2a 66 44 6f 63 | 54 45 3b 0d 09 69 66 20 | = *fDoc|TE;..if |
|00004690| 28 20 69 73 56 65 72 74 | 20 29 0d 09 20 20 76 61 |( isVert| ).. va|
|000046a0| 6c 75 65 20 3d 20 28 74 | 65 2d 3e 76 69 65 77 52 |lue = (t|e->viewR|
|000046b0| 65 63 74 2e 74 6f 70 20 | 2d 20 74 65 2d 3e 64 65 |ect.top |- te->de|
|000046c0| 73 74 52 65 63 74 2e 74 | 6f 70 29 20 2f 20 74 65 |stRect.t|op) / te|
|000046d0| 2d 3e 6c 69 6e 65 48 65 | 69 67 68 74 3b 0d 09 65 |->lineHe|ight;..e|
|000046e0| 6c 73 65 20 76 61 6c 75 | 65 20 3d 20 74 65 2d 3e |lse valu|e = te->|
|000046f0| 76 69 65 77 52 65 63 74 | 2e 6c 65 66 74 20 2d 20 |viewRect|.left - |
|00004700| 74 65 2d 3e 64 65 73 74 | 52 65 63 74 2e 6c 65 66 |te->dest|Rect.lef|
|00004710| 74 3b 0d 09 0d 09 69 66 | 20 28 20 76 61 6c 75 65 |t;....if| ( value|
|00004720| 20 3c 20 30 20 29 0d 09 | 20 20 76 61 6c 75 65 20 | < 0 )..| value |
|00004730| 3d 20 30 3b 0d 09 65 6c | 73 65 20 69 66 20 28 20 |= 0;..el|se if ( |
|00004740| 76 61 6c 75 65 20 3e 20 | 20 6d 61 78 20 29 0d 09 |value > | max )..|
|00004750| 20 20 76 61 6c 75 65 20 | 3d 20 6d 61 78 3b 0d 09 | value |= max;..|
|00004760| 0d 09 53 65 74 43 74 6c | 56 61 6c 75 65 28 63 6f |..SetCtl|Value(co|
|00004770| 6e 74 72 6f 6c 2c 20 76 | 61 6c 75 65 29 3b 0d 09 |ntrol, v|alue);..|
|00004780| 2f 2f 20 6e 6f 77 20 72 | 65 64 72 61 77 20 74 68 |// now r|edraw th|
|00004790| 65 20 63 6f 6e 74 72 6f | 6c 20 69 66 20 61 73 6b |e contro|l if ask|
|000047a0| 65 64 20 74 6f 20 6f 72 | 20 69 66 20 61 20 73 65 |ed to or| if a se|
|000047b0| 74 74 69 6e 67 20 63 68 | 61 6e 67 65 64 20 0d 09 |tting ch|anged ..|
|000047c0| 69 66 20 28 20 6d 75 73 | 74 52 65 64 72 61 77 20 |if ( mus|tRedraw |
|000047d0| 7c 7c 20 28 6d 61 78 20 | 21 3d 20 6f 6c 64 4d 61 ||| (max |!= oldMa|
|000047e0| 78 29 20 7c 7c 20 28 76 | 61 6c 75 65 20 21 3d 20 |x) || (v|alue != |
|000047f0| 6f 6c 64 56 61 6c 75 65 | 29 20 29 0d 09 09 53 68 |oldValue|) )...Sh|
|00004800| 6f 77 43 6f 6e 74 72 6f | 6c 28 63 6f 6e 74 72 6f |owContro|l(contro|
|00004810| 6c 29 3b 0d 7d 20 2f 2f | 20 41 64 6a 75 73 74 48 |l);.} //| AdjustH|
|00004820| 56 0d 0d 2f 2f 20 53 69 | 6d 70 6c 79 20 63 61 6c |V..// Si|mply cal|
|00004830| 6c 20 74 68 65 20 63 6f | 6d 6d 6f 6e 20 61 64 6a |l the co|mmon adj|
|00004840| 75 73 74 20 72 6f 75 74 | 69 6e 65 20 66 6f 72 20 |ust rout|ine for |
|00004850| 74 68 65 20 76 65 72 74 | 69 63 61 6c 20 61 6e 64 |the vert|ical and|
|00004860| 20 68 6f 72 69 7a 6f 6e | 74 61 6c 20 73 63 72 6f | horizon|tal scro|
|00004870| 6c 6c 62 61 72 73 2e 20 | 0d 0d 76 6f 69 64 20 54 |llbars. |..void T|
|00004880| 45 44 6f 63 75 6d 65 6e | 74 3a 3a 41 64 6a 75 73 |EDocumen|t::Adjus|
|00004890| 74 53 63 72 6f 6c 6c 56 | 61 6c 75 65 73 28 42 6f |tScrollV|alues(Bo|
|000048a0| 6f 6c 65 61 6e 20 6d 75 | 73 74 52 65 64 72 61 77 |olean mu|stRedraw|
|000048b0| 29 0d 7b 0d 09 41 64 6a | 75 73 74 48 56 28 74 72 |).{..Adj|ustHV(tr|
|000048c0| 75 65 2c 20 6d 75 73 74 | 52 65 64 72 61 77 29 3b |ue, must|Redraw);|
|000048d0| 0d 09 41 64 6a 75 73 74 | 48 56 28 66 61 6c 73 65 |..Adjust|HV(false|
|000048e0| 2c 20 6d 75 73 74 52 65 | 64 72 61 77 29 3b 0d 7d |, mustRe|draw);.}|
|000048f0| 20 2f 2f 20 41 64 6a 75 | 73 74 53 63 72 6f 6c 6c | // Adju|stScroll|
|00004900| 56 61 6c 75 65 73 0d 0d | 43 6c 69 6b 4c 6f 6f 70 |Values..|ClikLoop|
|00004910| 50 72 6f 63 50 74 72 20 | 54 45 44 6f 63 75 6d 65 |ProcPtr |TEDocume|
|00004920| 6e 74 3a 3a 47 65 74 43 | 6c 69 6b 4c 6f 6f 70 28 |nt::GetC|likLoop(|
|00004930| 29 0d 7b 0d 09 72 65 74 | 75 72 6e 20 66 44 6f 63 |).{..ret|urn fDoc|
|00004940| 43 6c 69 6b 3b 0d 7d 0d | 0d 54 45 48 61 6e 64 6c |Clik;.}.|.TEHandl|
|00004950| 65 20 54 45 44 6f 63 75 | 6d 65 6e 74 3a 3a 47 65 |e TEDocu|ment::Ge|
|00004960| 74 54 45 48 61 6e 64 6c | 65 28 29 0d 7b 0d 09 72 |tTEHandl|e().{..r|
|00004970| 65 74 75 72 6e 20 66 44 | 6f 63 54 45 3b 0d 7d 0d |eturn fD|ocTE;.}.|
|00004980| 0d 76 6f 69 64 20 54 45 | 44 6f 63 75 6d 65 6e 74 |.void TE|Document|
|00004990| 3a 3a 44 6f 43 75 74 28 | 29 0d 7b 0d 09 6c 6f 6e |::DoCut(|).{..lon|
|000049a0| 67 20 74 6f 74 61 6c 2c | 20 63 6f 6e 74 69 67 3b |g total,| contig;|
|000049b0| 0d 0d 09 69 66 20 28 5a | 65 72 6f 53 63 72 61 70 |...if (Z|eroScrap|
|000049c0| 28 29 20 3d 3d 20 6e 6f | 45 72 72 29 0d 09 20 20 |() == no|Err).. |
|000049d0| 7b 0d 09 09 50 75 72 67 | 65 53 70 61 63 65 28 26 |{...Purg|eSpace(&|
|000049e0| 74 6f 74 61 6c 2c 20 26 | 63 6f 6e 74 69 67 29 3b |total, &|contig);|
|000049f0| 0d 09 09 69 66 20 28 28 | 2a 66 44 6f 63 54 45 29 |...if ((|*fDocTE)|
|00004a00| 2d 3e 73 65 6c 45 6e 64 | 20 2d 20 28 2a 66 44 6f |->selEnd| - (*fDo|
|00004a10| 63 54 45 29 2d 3e 73 65 | 6c 53 74 61 72 74 20 2b |cTE)->se|lStart +|
|00004a20| 20 6b 54 45 53 6c 6f 70 | 20 3e 20 63 6f 6e 74 69 | kTESlop| > conti|
|00004a30| 67 29 0d 09 09 20 20 41 | 6c 65 72 74 55 73 65 72 |g)... A|lertUser|
|00004a40| 28 6b 54 45 44 6f 63 45 | 72 72 53 74 72 69 6e 67 |(kTEDocE|rrString|
|00004a50| 73 2c 65 4e 6f 53 70 61 | 63 65 43 75 74 29 3b 0d |s,eNoSpa|ceCut);.|
|00004a60| 09 09 65 6c 73 65 0d 09 | 09 20 20 7b 0d 09 09 09 |..else..|. {....|
|00004a70| 54 45 43 75 74 28 66 44 | 6f 63 54 45 29 3b 0d 09 |TECut(fD|ocTE);..|
|00004a80| 09 09 69 66 20 28 54 45 | 54 6f 53 63 72 61 70 28 |..if (TE|ToScrap(|
|00004a90| 29 20 21 3d 20 6e 6f 45 | 72 72 29 0d 09 09 09 20 |) != noE|rr).... |
|00004aa0| 20 7b 0d 09 09 09 09 41 | 6c 65 72 74 55 73 65 72 | {.....A|lertUser|
|00004ab0| 28 6b 54 45 44 6f 63 45 | 72 72 53 74 72 69 6e 67 |(kTEDocE|rrString|
|00004ac0| 73 2c 65 4e 6f 43 75 74 | 29 3b 0d 09 09 09 09 28 |s,eNoCut|);.....(|
|00004ad0| 76 6f 69 64 29 20 5a 65 | 72 6f 53 63 72 61 70 28 |void) Ze|roScrap(|
|00004ae0| 29 3b 0d 09 09 09 20 20 | 7d 0d 09 09 20 20 7d 0d |);.... |}... }.|
|00004af0| 09 20 20 7d 0d 09 41 64 | 6a 75 73 74 53 63 72 6f |. }..Ad|justScro|
|00004b00| 6c 6c 62 61 72 73 28 66 | 61 6c 73 65 29 3b 0d 09 |llbars(f|alse);..|
|00004b10| 41 64 6a 75 73 74 54 45 | 28 29 3b 0d 7d 0d 0d 76 |AdjustTE|();.}..v|
|00004b20| 6f 69 64 20 54 45 44 6f | 63 75 6d 65 6e 74 3a 3a |oid TEDo|cument::|
|00004b30| 44 6f 43 6f 70 79 28 29 | 0d 7b 0d 09 69 66 20 28 |DoCopy()|.{..if (|
|00004b40| 20 5a 65 72 6f 53 63 72 | 61 70 28 29 20 3d 3d 20 | ZeroScr|ap() == |
|00004b50| 6e 6f 45 72 72 20 29 0d | 09 20 20 7b 0d 09 09 54 |noErr ).|. {...T|
|00004b60| 45 43 6f 70 79 28 66 44 | 6f 63 54 45 29 3b 09 09 |ECopy(fD|ocTE);..|
|00004b70| 09 09 2f 2f 20 61 66 74 | 65 72 20 63 6f 70 79 69 |..// aft|er copyi|
|00004b80| 6e 67 2c 20 65 78 70 6f | 72 74 20 74 68 65 20 54 |ng, expo|rt the T|
|00004b90| 45 20 73 63 72 61 70 0d | 09 09 69 66 20 28 20 54 |E scrap.|..if ( T|
|00004ba0| 45 54 6f 53 63 72 61 70 | 28 29 20 21 3d 20 6e 6f |EToScrap|() != no|
|00004bb0| 45 72 72 20 29 0d 09 09 | 20 20 7b 0d 09 09 09 41 |Err )...| {....A|
|00004bc0| 6c 65 72 74 55 73 65 72 | 28 6b 54 45 44 6f 63 45 |lertUser|(kTEDocE|
|00004bd0| 72 72 53 74 72 69 6e 67 | 73 2c 65 4e 6f 43 6f 70 |rrString|s,eNoCop|
|00004be0| 79 29 3b 0d 09 09 09 5a | 65 72 6f 53 63 72 61 70 |y);....Z|eroScrap|
|00004bf0| 28 29 3b 0d 09 09 20 20 | 7d 0d 09 20 20 7d 0d 09 |();... |}.. }..|
|00004c00| 41 64 6a 75 73 74 53 63 | 72 6f 6c 6c 62 61 72 73 |AdjustSc|rollbars|
|00004c10| 28 66 61 6c 73 65 29 3b | 0d 09 41 64 6a 75 73 74 |(false);|..Adjust|
|00004c20| 54 45 28 29 3b 0d 7d 0d | 0d 76 6f 69 64 20 54 45 |TE();.}.|.void TE|
|00004c30| 44 6f 63 75 6d 65 6e 74 | 3a 3a 44 6f 50 61 73 74 |Document|::DoPast|
|00004c40| 65 28 29 0d 7b 0d 09 48 | 61 6e 64 6c 65 20 61 48 |e().{..H|andle aH|
|00004c50| 61 6e 64 6c 65 3b 0d 09 | 6c 6f 6e 67 20 6f 6c 64 |andle;..|long old|
|00004c60| 53 69 7a 65 2c 20 6e 65 | 77 53 69 7a 65 3b 0d 09 |Size, ne|wSize;..|
|00004c70| 4f 53 45 72 72 20 73 61 | 76 65 45 72 72 3b 0d 0d |OSErr sa|veErr;..|
|00004c80| 09 69 66 20 28 20 54 45 | 46 72 6f 6d 53 63 72 61 |.if ( TE|FromScra|
|00004c90| 70 28 29 20 3d 3d 20 6e | 6f 45 72 72 20 29 0d 09 |p() == n|oErr )..|
|00004ca0| 20 20 7b 0d 09 09 69 66 | 20 28 20 54 45 47 65 74 | {...if| ( TEGet|
|00004cb0| 53 63 72 61 70 4c 65 6e | 28 29 20 2b 20 28 28 2a |ScrapLen|() + ((*|
|00004cc0| 66 44 6f 63 54 45 29 2d | 3e 74 65 4c 65 6e 67 74 |fDocTE)-|>teLengt|
|00004cd0| 68 20 2d 0d 09 09 09 20 | 28 28 2a 66 44 6f 63 54 |h -.... |((*fDocT|
|00004ce0| 45 29 2d 3e 73 65 6c 45 | 6e 64 20 2d 20 28 2a 66 |E)->selE|nd - (*f|
|00004cf0| 44 6f 63 54 45 29 2d 3e | 73 65 6c 53 74 61 72 74 |DocTE)->|selStart|
|00004d00| 29 29 20 3e 20 6b 4d 61 | 78 54 45 4c 65 6e 67 74 |)) > kMa|xTELengt|
|00004d10| 68 20 29 0d 09 09 20 20 | 41 6c 65 72 74 55 73 65 |h )... |AlertUse|
|00004d20| 72 28 6b 54 45 44 6f 63 | 45 72 72 53 74 72 69 6e |r(kTEDoc|ErrStrin|
|00004d30| 67 73 2c 65 45 78 63 65 | 65 64 50 61 73 74 65 29 |gs,eExce|edPaste)|
|00004d40| 3b 0d 09 09 65 6c 73 65 | 0d 09 09 20 20 7b 0d 09 |;...else|... {..|
|00004d50| 09 09 61 48 61 6e 64 6c | 65 20 3d 20 28 48 61 6e |..aHandl|e = (Han|
|00004d60| 64 6c 65 29 20 54 45 47 | 65 74 54 65 78 74 28 66 |dle) TEG|etText(f|
|00004d70| 44 6f 63 54 45 29 3b 0d | 09 09 09 6f 6c 64 53 69 |DocTE);.|...oldSi|
|00004d80| 7a 65 20 3d 20 47 65 74 | 48 61 6e 64 6c 65 53 69 |ze = Get|HandleSi|
|00004d90| 7a 65 28 61 48 61 6e 64 | 6c 65 29 3b 0d 09 09 09 |ze(aHand|le);....|
|00004da0| 6e 65 77 53 69 7a 65 20 | 3d 20 6f 6c 64 53 69 7a |newSize |= oldSiz|
|00004db0| 65 20 2b 20 54 45 47 65 | 74 53 63 72 61 70 4c 65 |e + TEGe|tScrapLe|
|00004dc0| 6e 28 29 20 2b 20 6b 54 | 45 53 6c 6f 70 3b 0d 09 |n() + kT|ESlop;..|
|00004dd0| 09 09 53 65 74 48 61 6e | 64 6c 65 53 69 7a 65 28 |..SetHan|dleSize(|
|00004de0| 61 48 61 6e 64 6c 65 2c | 20 6e 65 77 53 69 7a 65 |aHandle,| newSize|
|00004df0| 29 3b 0d 09 09 09 73 61 | 76 65 45 72 72 20 3d 20 |);....sa|veErr = |
|00004e00| 4d 65 6d 45 72 72 6f 72 | 28 29 3b 0d 09 09 09 53 |MemError|();....S|
|00004e10| 65 74 48 61 6e 64 6c 65 | 53 69 7a 65 28 61 48 61 |etHandle|Size(aHa|
|00004e20| 6e 64 6c 65 2c 20 6f 6c | 64 53 69 7a 65 29 3b 0d |ndle, ol|dSize);.|
|00004e30| 09 09 09 69 66 20 28 73 | 61 76 65 45 72 72 20 21 |...if (s|aveErr !|
|00004e40| 3d 20 6e 6f 45 72 72 29 | 0d 09 09 09 20 20 41 6c |= noErr)|.... Al|
|00004e50| 65 72 74 55 73 65 72 28 | 6b 54 45 44 6f 63 45 72 |ertUser(|kTEDocEr|
|00004e60| 72 53 74 72 69 6e 67 73 | 2c 65 4e 6f 53 70 61 63 |rStrings|,eNoSpac|
|00004e70| 65 50 61 73 74 65 29 3b | 0d 09 09 09 65 6c 73 65 |ePaste);|....else|
|00004e80| 20 54 45 50 61 73 74 65 | 28 66 44 6f 63 54 45 29 | TEPaste|(fDocTE)|
|00004e90| 3b 0d 09 09 20 20 7d 0d | 09 20 20 7d 0d 09 65 6c |;... }.|. }..el|
|00004ea0| 73 65 20 41 6c 65 72 74 | 55 73 65 72 28 6b 54 45 |se Alert|User(kTE|
|00004eb0| 44 6f 63 45 72 72 53 74 | 72 69 6e 67 73 2c 65 4e |DocErrSt|rings,eN|
|00004ec0| 6f 50 61 73 74 65 29 3b | 0d 09 41 64 6a 75 73 74 |oPaste);|..Adjust|
|00004ed0| 53 63 72 6f 6c 6c 62 61 | 72 73 28 66 61 6c 73 65 |Scrollba|rs(false|
|00004ee0| 29 3b 0d 09 41 64 6a 75 | 73 74 54 45 28 29 3b 0d |);..Adju|stTE();.|
|00004ef0| 7d 0d 0d 76 6f 69 64 20 | 54 45 44 6f 63 75 6d 65 |}..void |TEDocume|
|00004f00| 6e 74 3a 3a 44 6f 43 6c | 65 61 72 28 29 0d 7b 0d |nt::DoCl|ear().{.|
|00004f10| 09 54 45 44 65 6c 65 74 | 65 28 66 44 6f 63 54 45 |.TEDelet|e(fDocTE|
|00004f20| 29 3b 0d 09 41 64 6a 75 | 73 74 53 63 72 6f 6c 6c |);..Adju|stScroll|
|00004f30| 62 61 72 73 28 66 61 6c | 73 65 29 3b 0d 09 41 64 |bars(fal|se);..Ad|
|00004f40| 6a 75 73 74 54 45 28 29 | 3b 0d 7d 0d 0d 2f 2a 0d |justTE()|;.}../*.|
|00004f50| 09 52 6f 75 74 69 6e 65 | 73 20 75 73 65 64 20 62 |.Routine|s used b|
|00004f60| 79 20 74 68 69 73 20 63 | 6c 61 73 73 2c 20 77 68 |y this c|lass, wh|
|00004f70| 69 63 68 20 64 6f 6e 27 | 74 20 62 65 6c 6f 6e 67 |ich don'|t belong|
|00004f80| 20 74 6f 20 74 68 65 20 | 63 6c 61 73 73 20 73 69 | to the |class si|
|00004f90| 6e 63 65 20 77 65 20 75 | 73 65 0d 09 74 68 65 6d |nce we u|se..them|
|00004fa0| 20 61 73 20 74 6f 6f 6c | 62 6f 78 20 66 69 6c 74 | as tool|box filt|
|00004fb0| 65 72 20 72 6f 75 74 69 | 6e 65 73 2c 20 61 6e 64 |er routi|nes, and|
|00004fc0| 20 79 6f 75 20 63 61 6e | 6e 6f 74 20 70 61 73 73 | you can|not pass|
|00004fd0| 20 63 6c 61 73 73 20 6d | 65 74 68 6f 64 73 20 61 | class m|ethods a|
|00004fe0| 73 20 50 72 6f 63 50 74 | 72 73 2e 0d 2a 2f 0d 0d |s ProcPt|rs..*/..|
|00004ff0| 2f 2f 20 77 65 20 72 65 | 66 65 72 20 62 61 63 6b |// we re|fer back|
|00005000| 20 74 6f 20 74 68 65 20 | 6f 77 6e 69 6e 67 20 61 | to the |owning a|
|00005010| 70 70 6c 69 63 61 74 69 | 6f 6e 20 73 6f 20 74 68 |pplicati|on so th|
|00005020| 61 74 20 77 65 20 63 61 | 6e 20 67 65 74 20 61 63 |at we ca|n get ac|
|00005030| 63 65 73 73 20 74 6f 0d | 2f 2f 20 74 68 65 20 64 |cess to.|// the d|
|00005040| 6f 63 75 6d 65 6e 74 20 | 6c 69 73 74 2c 20 74 6f |ocument |list, to|
|00005050| 20 66 69 6e 64 20 74 68 | 65 20 63 75 72 72 65 6e | find th|e curren|
|00005060| 74 20 64 6f 63 75 6d 65 | 6e 74 20 6f 62 6a 65 63 |t docume|nt objec|
|00005070| 74 2e 0d 65 78 74 65 72 | 6e 20 54 45 53 61 6d 70 |t..exter|n TESamp|
|00005080| 6c 65 2a 20 67 54 68 65 | 41 70 70 6c 69 63 61 74 |le* gThe|Applicat|
|00005090| 69 6f 6e 3b 0d 0d 2f 2f | 20 43 6f 6d 6d 6f 6e 20 |ion;..//| Common |
|000050a0| 61 6c 67 6f 72 69 74 68 | 6d 20 66 6f 72 20 70 69 |algorith|m for pi|
|000050b0| 6e 6e 69 6e 67 20 74 68 | 65 20 76 61 6c 75 65 20 |nning th|e value |
|000050c0| 6f 66 20 61 20 63 6f 6e | 74 72 6f 6c 2e 20 49 74 |of a con|trol. It|
|000050d0| 20 72 65 74 75 72 6e 73 | 20 74 68 65 20 61 63 74 | returns| the act|
|000050e0| 75 61 6c 20 61 6d 6f 75 | 6e 74 0d 2f 2f 20 74 68 |ual amou|nt.// th|
|000050f0| 65 20 76 61 6c 75 65 20 | 6f 66 20 74 68 65 20 63 |e value |of the c|
|00005100| 6f 6e 74 72 6f 6c 20 63 | 68 61 6e 67 65 64 2e 0d |ontrol c|hanged..|
|00005110| 0d 76 6f 69 64 20 43 6f | 6d 6d 6f 6e 41 63 74 69 |.void Co|mmonActi|
|00005120| 6f 6e 28 43 6f 6e 74 72 | 6f 6c 48 61 6e 64 6c 65 |on(Contr|olHandle|
|00005130| 20 63 6f 6e 74 72 6f 6c | 2c 73 68 6f 72 74 2a 20 | control|,short* |
|00005140| 61 6d 6f 75 6e 74 29 0d | 7b 0d 09 73 68 6f 72 74 |amount).|{..short|
|00005150| 09 09 76 61 6c 75 65 2c | 20 6d 61 78 3b 0d 09 0d |..value,| max;...|
|00005160| 09 76 61 6c 75 65 20 3d | 20 47 65 74 43 74 6c 56 |.value =| GetCtlV|
|00005170| 61 6c 75 65 28 63 6f 6e | 74 72 6f 6c 29 3b 0d 09 |alue(con|trol);..|
|00005180| 6d 61 78 20 3d 20 47 65 | 74 43 74 6c 4d 61 78 28 |max = Ge|tCtlMax(|
|00005190| 63 6f 6e 74 72 6f 6c 29 | 3b 0d 09 2a 61 6d 6f 75 |control)|;..*amou|
|000051a0| 6e 74 20 3d 20 76 61 6c | 75 65 20 2d 20 2a 61 6d |nt = val|ue - *am|
|000051b0| 6f 75 6e 74 3b 0d 09 69 | 66 20 28 20 2a 61 6d 6f |ount;..i|f ( *amo|
|000051c0| 75 6e 74 20 3c 3d 20 30 | 20 29 0d 09 09 2a 61 6d |unt <= 0| )...*am|
|000051d0| 6f 75 6e 74 20 3d 20 30 | 3b 0d 09 65 6c 73 65 20 |ount = 0|;..else |
|000051e0| 69 66 20 28 20 2a 61 6d | 6f 75 6e 74 20 3e 3d 20 |if ( *am|ount >= |
|000051f0| 6d 61 78 20 29 0d 09 09 | 2a 61 6d 6f 75 6e 74 20 |max )...|*amount |
|00005200| 3d 20 6d 61 78 3b 0d 09 | 53 65 74 43 74 6c 56 61 |= max;..|SetCtlVa|
|00005210| 6c 75 65 28 63 6f 6e 74 | 72 6f 6c 2c 20 2a 61 6d |lue(cont|rol, *am|
|00005220| 6f 75 6e 74 29 3b 0d 09 | 2a 61 6d 6f 75 6e 74 20 |ount);..|*amount |
|00005230| 3d 20 76 61 6c 75 65 20 | 2d 20 2a 61 6d 6f 75 6e |= value |- *amoun|
|00005240| 74 3b 0d 7d 20 2f 2f 20 | 43 6f 6d 6d 6f 6e 41 63 |t;.} // |CommonAc|
|00005250| 74 69 6f 6e 20 0d 0d 0d | 2f 2f 20 44 65 74 65 72 |tion ...|// Deter|
|00005260| 6d 69 6e 65 73 20 68 6f | 77 20 6d 75 63 68 20 74 |mines ho|w much t|
|00005270| 6f 20 63 68 61 6e 67 65 | 20 74 68 65 20 76 61 6c |o change| the val|
|00005280| 75 65 20 6f 66 20 74 68 | 65 20 76 65 72 74 69 63 |ue of th|e vertic|
|00005290| 61 6c 20 73 63 72 6f 6c | 6c 62 61 72 20 62 79 20 |al scrol|lbar by |
|000052a0| 61 6e 64 20 68 6f 77 0d | 2f 2f 20 6d 75 63 68 20 |and how.|// much |
|000052b0| 74 6f 20 73 63 72 6f 6c | 6c 20 74 68 65 20 54 45 |to scrol|l the TE|
|000052c0| 20 72 65 63 6f 72 64 2e | 0d 0d 70 61 73 63 61 6c | record.|..pascal|
|000052d0| 20 76 6f 69 64 20 56 41 | 63 74 69 6f 6e 50 72 6f | void VA|ctionPro|
|000052e0| 63 28 43 6f 6e 74 72 6f | 6c 48 61 6e 64 6c 65 20 |c(Contro|lHandle |
|000052f0| 63 6f 6e 74 72 6f 6c 2c | 73 68 6f 72 74 20 70 61 |control,|short pa|
|00005300| 72 74 29 0d 7b 0d 09 73 | 68 6f 72 74 09 09 61 6d |rt).{..s|hort..am|
|00005310| 6f 75 6e 74 3b 0d 09 57 | 69 6e 64 6f 77 50 74 72 |ount;..W|indowPtr|
|00005320| 09 77 69 6e 64 6f 77 3b | 0d 09 54 45 50 74 72 09 |.window;|..TEPtr.|
|00005330| 09 74 65 3b 0d 09 54 45 | 44 6f 63 75 6d 65 6e 74 |.te;..TE|Document|
|00005340| 2a 20 64 6f 63 3b 0d 0d | 09 69 66 20 28 20 70 61 |* doc;..|.if ( pa|
|00005350| 72 74 20 21 3d 20 30 20 | 29 0d 09 20 20 7b 0d 09 |rt != 0 |).. {..|
|00005360| 09 77 69 6e 64 6f 77 20 | 3d 20 28 2a 63 6f 6e 74 |.window |= (*cont|
|00005370| 72 6f 6c 29 2d 3e 63 6f | 6e 74 72 6c 4f 77 6e 65 |rol)->co|ntrlOwne|
|00005380| 72 3b 0d 09 09 64 6f 63 | 20 3d 20 28 54 45 44 6f |r;...doc| = (TEDo|
|00005390| 63 75 6d 65 6e 74 2a 29 | 20 28 67 54 68 65 41 70 |cument*)| (gTheAp|
|000053a0| 70 6c 69 63 61 74 69 6f | 6e 2d 3e 44 6f 63 4c 69 |plicatio|n->DocLi|
|000053b0| 73 74 28 29 29 2d 3e 46 | 69 6e 64 44 6f 63 28 77 |st())->F|indDoc(w|
|000053c0| 69 6e 64 6f 77 29 3b 0d | 09 09 74 65 20 3d 20 2a |indow);.|..te = *|
|000053d0| 28 64 6f 63 2d 3e 47 65 | 74 54 45 48 61 6e 64 6c |(doc->Ge|tTEHandl|
|000053e0| 65 28 29 29 3b 0d 09 09 | 73 77 69 74 63 68 20 28 |e());...|switch (|
|000053f0| 20 70 61 72 74 20 29 0d | 09 09 20 20 7b 0d 09 09 | part ).|.. {...|
|00005400| 09 63 61 73 65 20 69 6e | 55 70 42 75 74 74 6f 6e |.case in|UpButton|
|00005410| 3a 0d 09 09 09 63 61 73 | 65 20 69 6e 44 6f 77 6e |:....cas|e inDown|
|00005420| 42 75 74 74 6f 6e 3a 09 | 09 2f 2f 20 6f 6e 65 20 |Button:.|.// one |
|00005430| 6c 69 6e 65 20 0d 09 09 | 09 09 61 6d 6f 75 6e 74 |line ...|..amount|
|00005440| 20 3d 20 31 3b 0d 09 09 | 09 09 62 72 65 61 6b 3b | = 1;...|..break;|
|00005450| 0d 09 09 09 63 61 73 65 | 20 69 6e 50 61 67 65 55 |....case| inPageU|
|00005460| 70 3a 09 09 09 2f 2f 20 | 6f 6e 65 20 70 61 67 65 |p:...// |one page|
|00005470| 20 0d 09 09 09 63 61 73 | 65 20 69 6e 50 61 67 65 | ....cas|e inPage|
|00005480| 44 6f 77 6e 3a 0d 09 09 | 09 09 61 6d 6f 75 6e 74 |Down:...|..amount|
|00005490| 20 3d 20 28 74 65 2d 3e | 76 69 65 77 52 65 63 74 | = (te->|viewRect|
|000054a0| 2e 62 6f 74 74 6f 6d 20 | 2d 20 74 65 2d 3e 76 69 |.bottom |- te->vi|
|000054b0| 65 77 52 65 63 74 2e 74 | 6f 70 29 20 2f 20 74 65 |ewRect.t|op) / te|
|000054c0| 2d 3e 6c 69 6e 65 48 65 | 69 67 68 74 3b 0d 09 09 |->lineHe|ight;...|
|000054d0| 09 09 62 72 65 61 6b 3b | 0d 09 09 20 20 7d 0d 09 |..break;|... }..|
|000054e0| 09 69 66 20 28 20 28 70 | 61 72 74 20 3d 3d 20 69 |.if ( (p|art == i|
|000054f0| 6e 44 6f 77 6e 42 75 74 | 74 6f 6e 29 20 7c 7c 20 |nDownBut|ton) || |
|00005500| 28 70 61 72 74 20 3d 3d | 20 69 6e 50 61 67 65 44 |(part ==| inPageD|
|00005510| 6f 77 6e 29 20 29 0d 09 | 09 09 61 6d 6f 75 6e 74 |own) )..|..amount|
|00005520| 20 3d 20 2d 61 6d 6f 75 | 6e 74 3b 09 09 2f 2f 20 | = -amou|nt;..// |
|00005530| 72 65 76 65 72 73 65 20 | 64 69 72 65 63 74 69 6f |reverse |directio|
|00005540| 6e 20 66 6f 72 20 61 20 | 64 6f 77 6e 65 72 20 0d |n for a |downer .|
|00005550| 09 09 43 6f 6d 6d 6f 6e | 41 63 74 69 6f 6e 28 63 |..Common|Action(c|
|00005560| 6f 6e 74 72 6f 6c 2c 20 | 26 61 6d 6f 75 6e 74 29 |ontrol, |&amount)|
|00005570| 3b 0d 09 09 69 66 20 28 | 20 61 6d 6f 75 6e 74 20 |;...if (| amount |
|00005580| 21 3d 20 30 20 29 0d 09 | 09 09 54 45 53 63 72 6f |!= 0 )..|..TEScro|
|00005590| 6c 6c 28 30 2c 20 61 6d | 6f 75 6e 74 20 2a 20 74 |ll(0, am|ount * t|
|000055a0| 65 2d 3e 6c 69 6e 65 48 | 65 69 67 68 74 2c 20 64 |e->lineH|eight, d|
|000055b0| 6f 63 2d 3e 47 65 74 54 | 45 48 61 6e 64 6c 65 28 |oc->GetT|EHandle(|
|000055c0| 29 29 3b 0d 09 20 20 7d | 0d 7d 20 2f 2f 20 56 41 |));.. }|.} // VA|
|000055d0| 63 74 69 6f 6e 50 72 6f | 63 20 0d 0d 2f 2f 20 44 |ctionPro|c ..// D|
|000055e0| 65 74 65 72 6d 69 6e 65 | 73 20 68 6f 77 20 6d 75 |etermine|s how mu|
|000055f0| 63 68 20 74 6f 20 63 68 | 61 6e 67 65 20 74 68 65 |ch to ch|ange the|
|00005600| 20 76 61 6c 75 65 20 6f | 66 20 74 68 65 20 68 6f | value o|f the ho|
|00005610| 72 69 7a 6f 6e 74 61 6c | 20 73 63 72 6f 6c 6c 62 |rizontal| scrollb|
|00005620| 61 72 20 62 79 20 61 6e | 64 20 68 6f 77 0d 2f 2f |ar by an|d how.//|
|00005630| 20 6d 75 63 68 20 74 6f | 20 73 63 72 6f 6c 6c 20 | much to| scroll |
|00005640| 74 68 65 20 54 45 20 72 | 65 63 6f 72 64 2e 0d 0d |the TE r|ecord...|
|00005650| 70 61 73 63 61 6c 20 76 | 6f 69 64 20 48 41 63 74 |pascal v|oid HAct|
|00005660| 69 6f 6e 50 72 6f 63 28 | 43 6f 6e 74 72 6f 6c 48 |ionProc(|ControlH|
|00005670| 61 6e 64 6c 65 20 63 6f | 6e 74 72 6f 6c 2c 73 68 |andle co|ntrol,sh|
|00005680| 6f 72 74 20 70 61 72 74 | 29 0d 7b 0d 09 73 68 6f |ort part|).{..sho|
|00005690| 72 74 09 09 61 6d 6f 75 | 6e 74 3b 0d 09 57 69 6e |rt..amou|nt;..Win|
|000056a0| 64 6f 77 50 74 72 09 77 | 69 6e 64 6f 77 3b 0d 09 |dowPtr.w|indow;..|
|000056b0| 54 45 50 74 72 09 09 74 | 65 3b 0d 09 54 45 44 6f |TEPtr..t|e;..TEDo|
|000056c0| 63 75 6d 65 6e 74 2a 20 | 64 6f 63 3b 0d 0d 09 69 |cument* |doc;...i|
|000056d0| 66 20 28 20 70 61 72 74 | 20 21 3d 20 30 20 29 0d |f ( part| != 0 ).|
|000056e0| 09 20 20 7b 0d 09 09 77 | 69 6e 64 6f 77 20 3d 20 |. {...w|indow = |
|000056f0| 28 2a 63 6f 6e 74 72 6f | 6c 29 2d 3e 63 6f 6e 74 |(*contro|l)->cont|
|00005700| 72 6c 4f 77 6e 65 72 3b | 0d 09 09 64 6f 63 20 3d |rlOwner;|...doc =|
|00005710| 20 28 54 45 44 6f 63 75 | 6d 65 6e 74 2a 29 20 28 | (TEDocu|ment*) (|
|00005720| 67 54 68 65 41 70 70 6c | 69 63 61 74 69 6f 6e 2d |gTheAppl|ication-|
|00005730| 3e 44 6f 63 4c 69 73 74 | 28 29 29 2d 3e 46 69 6e |>DocList|())->Fin|
|00005740| 64 44 6f 63 28 77 69 6e | 64 6f 77 29 3b 0d 09 09 |dDoc(win|dow);...|
|00005750| 74 65 20 3d 20 2a 28 64 | 6f 63 2d 3e 47 65 74 54 |te = *(d|oc->GetT|
|00005760| 45 48 61 6e 64 6c 65 28 | 29 29 3b 0d 09 09 73 77 |EHandle(|));...sw|
|00005770| 69 74 63 68 20 28 20 70 | 61 72 74 20 29 0d 09 09 |itch ( p|art )...|
|00005780| 20 20 7b 0d 09 09 09 63 | 61 73 65 20 69 6e 55 70 | {....c|ase inUp|
|00005790| 42 75 74 74 6f 6e 3a 0d | 09 09 09 63 61 73 65 20 |Button:.|...case |
|000057a0| 69 6e 44 6f 77 6e 42 75 | 74 74 6f 6e 3a 09 09 2f |inDownBu|tton:../|
|000057b0| 2f 20 61 20 66 65 77 20 | 70 69 78 65 6c 73 20 0d |/ a few |pixels .|
|000057c0| 09 09 09 09 61 6d 6f 75 | 6e 74 20 3d 20 34 3b 0d |....amou|nt = 4;.|
|000057d0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 63 61 |....brea|k;....ca|
|000057e0| 73 65 20 69 6e 50 61 67 | 65 55 70 3a 09 09 09 2f |se inPag|eUp:.../|
|000057f0| 2f 20 61 20 70 61 67 65 | 20 0d 09 09 09 63 61 73 |/ a page| ....cas|
|00005800| 65 20 69 6e 50 61 67 65 | 44 6f 77 6e 3a 0d 09 09 |e inPage|Down:...|
|00005810| 09 09 61 6d 6f 75 6e 74 | 20 3d 20 74 65 2d 3e 76 |..amount| = te->v|
|00005820| 69 65 77 52 65 63 74 2e | 72 69 67 68 74 20 2d 20 |iewRect.|right - |
|00005830| 74 65 2d 3e 76 69 65 77 | 52 65 63 74 2e 6c 65 66 |te->view|Rect.lef|
|00005840| 74 3b 0d 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |t;.....b|reak;...|
|00005850| 20 20 7d 0d 09 09 69 66 | 20 28 20 28 70 61 72 74 | }...if| ( (part|
|00005860| 20 3d 3d 20 69 6e 44 6f | 77 6e 42 75 74 74 6f 6e | == inDo|wnButton|
|00005870| 29 20 7c 7c 20 28 70 61 | 72 74 20 3d 3d 20 69 6e |) || (pa|rt == in|
|00005880| 50 61 67 65 44 6f 77 6e | 29 20 29 0d 09 09 09 61 |PageDown|) )....a|
|00005890| 6d 6f 75 6e 74 20 3d 20 | 2d 61 6d 6f 75 6e 74 3b |mount = |-amount;|
|000058a0| 09 09 2f 2f 20 72 65 76 | 65 72 73 65 20 64 69 72 |..// rev|erse dir|
|000058b0| 65 63 74 69 6f 6e 20 0d | 09 09 43 6f 6d 6d 6f 6e |ection .|..Common|
|000058c0| 41 63 74 69 6f 6e 28 63 | 6f 6e 74 72 6f 6c 2c 20 |Action(c|ontrol, |
|000058d0| 26 61 6d 6f 75 6e 74 29 | 3b 0d 09 09 69 66 20 28 |&amount)|;...if (|
|000058e0| 20 61 6d 6f 75 6e 74 20 | 21 3d 20 30 20 29 0d 09 | amount |!= 0 )..|
|000058f0| 09 09 54 45 53 63 72 6f | 6c 6c 28 61 6d 6f 75 6e |..TEScro|ll(amoun|
|00005900| 74 2c 20 30 2c 20 64 6f | 63 2d 3e 47 65 74 54 45 |t, 0, do|c->GetTE|
|00005910| 48 61 6e 64 6c 65 28 29 | 29 3b 0d 09 20 20 7d 0d |Handle()|);.. }.|
|00005920| 7d 20 2f 2f 20 56 41 63 | 74 69 6f 6e 50 72 6f 63 |} // VAc|tionProc|
|00005930| 20 0d 0d 2f 2f 20 47 65 | 74 73 20 63 61 6c 6c 65 | ..// Ge|ts calle|
|00005940| 64 20 66 72 6f 6d 20 6f | 75 72 20 61 73 73 65 6d |d from o|ur assem|
|00005950| 62 6c 79 20 6c 61 6e 67 | 75 61 67 65 20 72 6f 75 |bly lang|uage rou|
|00005960| 74 69 6e 65 2c 20 41 73 | 6d 43 6c 69 6b 4c 6f 6f |tine, As|mClikLoo|
|00005970| 70 2c 20 77 68 69 63 68 | 20 69 73 20 69 6e 0d 2f |p, which| is in./|
|00005980| 2f 20 74 75 72 6e 20 63 | 61 6c 6c 65 64 20 62 79 |/ turn c|alled by|
|00005990| 20 74 68 65 20 54 45 43 | 6c 69 63 6b 20 74 6f 6f | the TEC|lick too|
|000059a0| 6c 62 6f 78 20 72 6f 75 | 74 69 6e 65 2e 20 53 61 |lbox rou|tine. Sa|
|000059b0| 76 65 73 20 74 68 65 20 | 77 69 6e 64 6f 77 73 20 |ves the |windows |
|000059c0| 63 6c 69 70 20 72 65 67 | 69 6f 6e 2c 0d 2f 2f 20 |clip reg|ion,.// |
|000059d0| 73 65 74 73 20 69 74 20 | 74 6f 20 74 68 65 20 70 |sets it |to the p|
|000059e0| 6f 72 74 52 65 63 74 2c | 20 61 64 6a 75 73 74 73 |ortRect,| adjusts|
|000059f0| 20 74 68 65 20 73 63 72 | 6f 6c 6c 62 61 72 20 76 | the scr|ollbar v|
|00005a00| 61 6c 75 65 73 20 74 6f | 20 6d 61 74 63 68 20 74 |alues to| match t|
|00005a10| 68 65 20 54 45 20 73 63 | 72 6f 6c 6c 0d 2f 2f 20 |he TE sc|roll.// |
|00005a20| 61 6d 6f 75 6e 74 2c 20 | 74 68 65 6e 20 72 65 73 |amount, |then res|
|00005a30| 74 6f 72 65 73 20 74 68 | 65 20 63 6c 69 70 20 72 |tores th|e clip r|
|00005a40| 65 67 69 6f 6e 2e 0d 0d | 70 61 73 63 61 6c 20 76 |egion...|pascal v|
|00005a50| 6f 69 64 20 50 61 73 63 | 61 6c 43 6c 69 6b 4c 6f |oid Pasc|alClikLo|
|00005a60| 6f 70 28 29 0d 7b 0d 09 | 52 67 6e 48 61 6e 64 6c |op().{..|RgnHandl|
|00005a70| 65 09 72 65 67 69 6f 6e | 3b 0d 09 57 69 6e 64 6f |e.region|;..Windo|
|00005a80| 77 50 74 72 20 09 77 69 | 6e 64 3b 0d 09 54 45 44 |wPtr .wi|nd;..TED|
|00005a90| 6f 63 75 6d 65 6e 74 2a | 20 64 6f 63 3b 0d 0d 09 |ocument*| doc;...|
|00005aa0| 77 69 6e 64 20 3d 20 46 | 72 6f 6e 74 57 69 6e 64 |wind = F|rontWind|
|00005ab0| 6f 77 28 29 3b 0d 09 64 | 6f 63 20 3d 20 28 54 45 |ow();..d|oc = (TE|
|00005ac0| 44 6f 63 75 6d 65 6e 74 | 2a 29 20 28 67 54 68 65 |Document|*) (gThe|
|00005ad0| 41 70 70 6c 69 63 61 74 | 69 6f 6e 2d 3e 44 6f 63 |Applicat|ion->Doc|
|00005ae0| 4c 69 73 74 28 29 29 2d | 3e 46 69 6e 64 44 6f 63 |List())-|>FindDoc|
|00005af0| 28 77 69 6e 64 29 3b 0d | 09 72 65 67 69 6f 6e 20 |(wind);.|.region |
|00005b00| 3d 20 4e 65 77 52 67 6e | 28 29 3b 0d 09 47 65 74 |= NewRgn|();..Get|
|00005b10| 43 6c 69 70 28 72 65 67 | 69 6f 6e 29 3b 09 2f 2f |Clip(reg|ion);.//|
|00005b20| 20 73 61 76 65 20 63 6c | 69 70 20 0d 09 43 6c 69 | save cl|ip ..Cli|
|00005b30| 70 52 65 63 74 28 26 77 | 69 6e 64 2d 3e 70 6f 72 |pRect(&w|ind->por|
|00005b40| 74 52 65 63 74 29 3b 0d | 09 64 6f 63 2d 3e 41 64 |tRect);.|.doc->Ad|
|00005b50| 6a 75 73 74 53 63 72 6f | 6c 6c 56 61 6c 75 65 73 |justScro|llValues|
|00005b60| 28 66 61 6c 73 65 29 3b | 0d 09 53 65 74 43 6c 69 |(false);|..SetCli|
|00005b70| 70 28 72 65 67 69 6f 6e | 29 3b 09 2f 2f 20 72 65 |p(region|);.// re|
|00005b80| 73 74 6f 72 65 20 63 6c | 69 70 20 0d 09 44 69 73 |store cl|ip ..Dis|
|00005b90| 70 6f 73 65 52 67 6e 28 | 72 65 67 69 6f 6e 29 3b |poseRgn(|region);|
|00005ba0| 0d 7d 20 2f 2f 20 50 61 | 73 63 61 6c 43 6c 69 6b |.} // Pa|scalClik|
|00005bb0| 4c 6f 6f 70 20 0d 0d 2f | 2f 20 47 65 74 73 20 63 |Loop ../|/ Gets c|
|00005bc0| 61 6c 6c 65 64 20 66 72 | 6f 6d 20 6f 75 72 20 61 |alled fr|om our a|
|00005bd0| 73 73 65 6d 62 6c 79 20 | 6c 61 6e 67 75 61 67 65 |ssembly |language|
|00005be0| 20 72 6f 75 74 69 6e 65 | 2c 20 41 73 6d 43 6c 69 | routine|, AsmCli|
|00005bf0| 6b 4c 6f 6f 70 2c 20 77 | 68 69 63 68 20 69 73 20 |kLoop, w|hich is |
|00005c00| 69 6e 0d 2f 2f 20 74 75 | 72 6e 20 63 61 6c 6c 65 |in.// tu|rn calle|
|00005c10| 64 20 62 79 20 74 68 65 | 20 54 45 43 6c 69 63 6b |d by the| TEClick|
|00005c20| 20 74 6f 6f 6c 62 6f 78 | 20 72 6f 75 74 69 6e 65 | toolbox| routine|
|00005c30| 2e 20 49 74 20 72 65 74 | 75 72 6e 73 20 74 68 65 |. It ret|urns the|
|00005c40| 20 61 64 64 72 65 73 73 | 20 6f 66 20 74 68 65 0d | address| of the.|
|00005c50| 2f 2f 20 64 65 66 61 75 | 6c 74 20 63 6c 69 6b 4c |// defau|lt clikL|
|00005c60| 6f 6f 70 20 72 6f 75 74 | 69 6e 65 20 74 68 61 74 |oop rout|ine that|
|00005c70| 20 77 61 73 20 70 75 74 | 20 69 6e 74 6f 20 74 68 | was put| into th|
|00005c80| 65 20 54 45 52 65 63 20 | 62 79 20 54 45 41 75 74 |e TERec |by TEAut|
|00005c90| 6f 56 69 65 77 20 74 6f | 0d 2f 2f 20 41 73 6d 43 |oView to|.// AsmC|
|00005ca0| 6c 69 6b 4c 6f 6f 70 20 | 73 6f 20 74 68 61 74 20 |likLoop |so that |
|00005cb0| 69 74 20 63 61 6e 20 63 | 61 6c 6c 20 69 74 2e 0d |it can c|all it..|
|00005cc0| 0d 70 61 73 63 61 6c 20 | 43 6c 69 6b 4c 6f 6f 70 |.pascal |ClikLoop|
|00005cd0| 50 72 6f 63 50 74 72 20 | 47 65 74 4f 6c 64 43 6c |ProcPtr |GetOldCl|
|00005ce0| 69 6b 4c 6f 6f 70 28 29 | 0d 7b 0d 09 54 45 44 6f |ikLoop()|.{..TEDo|
|00005cf0| 63 75 6d 65 6e 74 2a 20 | 64 6f 63 3b 0d 0d 09 64 |cument* |doc;...d|
|00005d00| 6f 63 20 3d 20 28 54 45 | 44 6f 63 75 6d 65 6e 74 |oc = (TE|Document|
|00005d10| 2a 29 20 28 67 54 68 65 | 41 70 70 6c 69 63 61 74 |*) (gThe|Applicat|
|00005d20| 69 6f 6e 2d 3e 44 6f 63 | 4c 69 73 74 28 29 29 2d |ion->Doc|List())-|
|00005d30| 3e 46 69 6e 64 44 6f 63 | 28 46 72 6f 6e 74 57 69 |>FindDoc|(FrontWi|
|00005d40| 6e 64 6f 77 28 29 29 3b | 0d 09 69 66 20 28 64 6f |ndow());|..if (do|
|00005d50| 63 20 3d 3d 20 6e 69 6c | 29 0d 09 20 20 72 65 74 |c == nil|).. ret|
|00005d60| 75 72 6e 20 6e 69 6c 3b | 0d 09 72 65 74 75 72 6e |urn nil;|..return|
|00005d70| 20 64 6f 63 2d 3e 47 65 | 74 43 6c 69 6b 4c 6f 6f | doc->Ge|tClikLoo|
|00005d80| 70 28 29 3b 0d 7d 20 2f | 2f 20 47 65 74 4f 6c 64 |p();.} /|/ GetOld|
|00005d90| 43 6c 69 6b 4c 6f 6f 70 | 0d 00 00 00 00 00 00 00 |ClikLoop|........|
|00005da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e00| 00 00 01 00 00 00 01 1e | 00 00 00 1e 00 00 00 1e |........|........|
|00005e10| 2f 0b 4e ba e4 f2 4a 00 | 50 8f 66 00 00 d0 20 6e |/.N...J.|P.f... n|
|00005e20| 00 08 4a 28 00 23 67 16 | 20 0b 67 12 2f 0b 2f 2e |..J(.#g.| .g././.|
|00005e30| 0d 54 45 44 6f 63 75 6d | 65 6e 74 2e 63 70 02 00 |.TEDocum|ent.cp..|
|00005e40| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 14 01 20 |..TEXTMP|S ..... |
|00005e50| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 14 01 20 |..TEXTMP|S ..... |
|00005e60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e70| 00 00 a1 4b 04 00 00 00 | 5d 19 00 00 01 3c 66 6c |...K....|]....<fl|
|00005e80| 2f 2d b0 c6 20 6e ff f4 | 4a 28 00 23 67 08 41 fa |/-.. n..|J(.#g.A.|
|00005e90| 00 d0 20 08 60 06 41 fa | 00 c0 20 08 2d 40 ff f0 |.. .`.A.|.. .-@..|
|00005ea0| 41 ee ff f0 2f 08 2d 6e | ff f4 ff ec 41 ee ff ec |A.../.-n|....A...|
|00005eb0| 2f 08 2d 6e 00 18 ff e8 | 41 ee ff e8 2f 08 48 7a |/.-n....|A.../.Hz|
|00005ec0| 00 80 4e ad 06 7a 4f ef | 00 14 60 20 20 6e ff fc |..N..zO.|..` n..|
|00005ed0| 2d 68 00 04 ff fc 4a ae | ff fc 66 00 fe 96 48 7a |-h....J.|..f...Hz|
|00005ee0| 00 48 70 69 2f 00 4e ad | 06 72 50 8f 4c ee 18 00 |.Hpi/.N.|.rP.L...|
|00005ef0| ff e0 4e 5e 4e 75 80 2e | 63 68 65 63 6b 5f 76 69 |..N^Nu..|check_vi|
|00005f00| 00 00 00 1a 03 01 40 09 | 00 00 05 33 2e 31 61 38 |......@.|...3.1a8|
|00005f10| 0d 4d 50 57 20 43 2b 2b | 20 33 2e 31 61 39 00 00 |.MPW C++| 3.1a9..|
|00005f20| 01 00 00 00 01 1e 00 00 | 00 1e 00 00 00 1e 00 1b |........|........|
|00005f30| 5f 08 0c 20 00 00 00 1c | 00 1e ff ff 00 00 00 00 |_.. ....|........|
|00005f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+